Coverage Report - org.jaudiotagger.tag.mp4.field.Mp4FieldType
 
Classes in this File Line Coverage Branch Coverage Complexity
Mp4FieldType
100%
32/32
N/A
0
 
 1  
 package org.jaudiotagger.tag.mp4.field;
 2  
 
 3  
 import org.jaudiotagger.tag.mp4.Mp4FieldKey;
 4  
 
 5  
 import java.util.EnumSet;
 6  
 import java.util.HashMap;
 7  
 
 8  
 /**
 9  
  * Describes the possible types of data held within a Databox
 10  
  */
 11  68
 public enum Mp4FieldType
 12  
 {
 13  17
     NUMERIC(0x0),
 14  17
     TEXT(0x1),
 15  17
     TEXT_UTF16BE(0x02),
 16  17
     TEXT_JAPANESE(0x03),
 17  17
     HTML(0x06),
 18  17
     XML(0x06),
 19  17
     GUID(0x08),
 20  17
     ISRC(0x09),
 21  17
     MI3P(0x10),
 22  17
     COVERART_GIF(0x0c),
 23  17
     COVERART_JPEG(0x0d),
 24  17
     COVERART_PNG(0x0e),
 25  17
     URL(0x0f),
 26  17
     DURATION(0x10),
 27  17
     DATETIME(0x11),
 28  17
     GENRES(0x12),
 29  17
     BYTE(0x15),
 30  17
     RIAAPA(0x18),
 31  17
     UPC(0x19),
 32  17
     COVERART_BMP(0x1B),
 33  
     ;
 34  
 
 35  
 
 36  
     private int fileClassId;
 37  
 
 38  
     Mp4FieldType(int fileClassId)
 39  340
     {
 40  340
         this.fileClassId = fileClassId;
 41  340
     }
 42  
 
 43  
     public int getFileClassId()
 44  
     {
 45  3919
         return fileClassId;
 46  
     }
 47  
 
 48  
     private final static HashMap <Integer, Mp4FieldType> fileClassIdFiedTypeMap;
 49  
 
 50  
     static
 51  
     {
 52  17
         fileClassIdFiedTypeMap = new HashMap<Integer, Mp4FieldType>(Mp4FieldType.values().length);
 53  357
         for (Mp4FieldType curr : Mp4FieldType.values())
 54  
         {
 55  340
             fileClassIdFiedTypeMap.put(curr.fileClassId,curr);
 56  
         }
 57  
     }
 58  
 
 59  
     /**
 60  
      *
 61  
      * @param fieldClassId
 62  
      * @return the Mp4FieldType that this fieldClassId maps to
 63  
      */
 64  
     public static Mp4FieldType getFieldType(int fieldClassId)
 65  
     {
 66  1686
         return fileClassIdFiedTypeMap.get(fieldClassId);
 67  
     }
 68  
 
 69  
     private static EnumSet<Mp4FieldType> coverArtTypes;
 70  
     static
 71  
     {
 72  17
         coverArtTypes = EnumSet.of(COVERART_GIF,COVERART_JPEG,COVERART_PNG,COVERART_BMP);
 73  17
     }
 74  
 
 75  
     /**
 76  
      *
 77  
      * @param mp4FieldType
 78  
      * @return true if this type is for identifying a image format to be used in cover art
 79  
      */
 80  
     public static boolean isCoverArtType(Mp4FieldType mp4FieldType)
 81  
     {
 82  1523
         return coverArtTypes.contains(mp4FieldType);
 83  
     }
 84  
 }