Coverage Report - org.jaudiotagger.tag.mp4.field.Mp4FieldType
 
Classes in this File Line Coverage Branch Coverage Complexity
Mp4FieldType
100%
32/32
N/A
1
 
 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  16
 public enum Mp4FieldType
 12  
 {
 13  4
     IMPLICIT(0x0),  //used for specialized formats such as TrackNo or DiscNo
 14  4
     TEXT(0x1),      //UTF-8
 15  4
     TEXT_UTF16BE(0x02),
 16  4
     TEXT_JAPANESE(0x03),
 17  4
     HTML(0x06),
 18  4
     XML(0x07),
 19  4
     GUID(0x08),
 20  4
     ISRC(0x09),
 21  4
     MI3P(0x0a),
 22  4
     COVERART_GIF(0x0c),
 23  4
     COVERART_JPEG(0x0d),
 24  4
     COVERART_PNG(0x0e),
 25  4
     URL(0x0f),
 26  4
     DURATION(0x10),
 27  4
     DATETIME(0x11),
 28  4
     GENRES(0x12),
 29  4
     INTEGER(0x15), //Formally known as byte
 30  4
     RIAAPA(0x18),
 31  4
     UPC(0x19),
 32  4
     COVERART_BMP(0x1B),
 33  
     ;
 34  
 
 35  
 
 36  
     private int fileClassId;
 37  
 
 38  
     Mp4FieldType(int fileClassId)
 39  80
     {
 40  80
         this.fileClassId = fileClassId;
 41  80
     }
 42  
 
 43  
     public int getFileClassId()
 44  
     {
 45  14064
         return fileClassId;
 46  
     }
 47  
 
 48  
     private final static HashMap <Integer, Mp4FieldType> fileClassIdFiedTypeMap;
 49  
 
 50  
     static
 51  
     {
 52  4
         fileClassIdFiedTypeMap = new HashMap<Integer, Mp4FieldType>(Mp4FieldType.values().length);
 53  84
         for (Mp4FieldType curr : Mp4FieldType.values())
 54  
         {
 55  80
             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  6078
         return fileClassIdFiedTypeMap.get(fieldClassId);
 67  
     }
 68  
 
 69  
     private static EnumSet<Mp4FieldType> coverArtTypes;
 70  
     static
 71  
     {
 72  4
         coverArtTypes = EnumSet.of(COVERART_GIF,COVERART_JPEG,COVERART_PNG,COVERART_BMP);
 73  4
     }
 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  5543
         return coverArtTypes.contains(mp4FieldType);
 83  
     }
 84  
 }