org.jaudiotagger.tag.mp4.field
Class Mp4TagCoverField

java.lang.Object
  extended by org.jaudiotagger.tag.mp4.Mp4TagField
      extended by org.jaudiotagger.tag.mp4.field.Mp4TagBinaryField
          extended by org.jaudiotagger.tag.mp4.field.Mp4TagCoverField
All Implemented Interfaces:
TagField

public class Mp4TagCoverField
extends Mp4TagBinaryField

Represents Cover Art

Note:Within this library we have a seperate TagCoverField for every image stored, however this does not map very directly to how they are physically stored within a file, because all are stored under a single covr atom, so a more complex conversion has to be done then for other fields when writing multiple images back to file.


Field Summary
 
Fields inherited from class org.jaudiotagger.tag.mp4.Mp4TagField
logger
 
Constructor Summary
Mp4TagCoverField()
          Empty CoverArt Field
Mp4TagCoverField(byte[] data)
          Construct new cover art with binarydata provided
Mp4TagCoverField(java.nio.ByteBuffer raw, int type)
          Construct CoverField by reading data from audio file
 
Method Summary
 Mp4FieldType getFieldType()
          Return field type, for artwork this also identifies the imagetype
 boolean isBinary()
          Determines whether the represented field contains (is made up of) binary data, instead of text data.
Software can identify fields to be displayed because they are human readable if this method returns false.
 java.lang.String toString()
          This method returns a human readable description of the fields contents.
For text fields it should be the text itself.
 
Methods inherited from class org.jaudiotagger.tag.mp4.field.Mp4TagBinaryField
copyContent, getData, getDataSize, isEmpty, setData
 
Methods inherited from class org.jaudiotagger.tag.mp4.Mp4TagField
getId, getRawContent, getRawContentDataOnly, isBinary, isCommon
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Mp4TagCoverField

public Mp4TagCoverField()
Empty CoverArt Field


Mp4TagCoverField

public Mp4TagCoverField(java.nio.ByteBuffer raw,
                        int type)
                 throws java.io.UnsupportedEncodingException
Construct CoverField by reading data from audio file

Parameters:
raw -
type -
Throws:
java.io.UnsupportedEncodingException

Mp4TagCoverField

public Mp4TagCoverField(byte[] data)
Construct new cover art with binarydata provided

Identifies the imagetype by looking at the data, if doesnt match PNG assumes it is JPEG TODO:Check how accurate is my method will it work for any PNG TODO:What about if they try to add data that is corrupt or not PNG or JPG

Parameters:
data -
Throws:
java.io.UnsupportedEncodingException
Method Detail

getFieldType

public Mp4FieldType getFieldType()
Return field type, for artwork this also identifies the imagetype

Overrides:
getFieldType in class Mp4TagBinaryField
Returns:
field type

isBinary

public boolean isBinary()
Description copied from interface: TagField
Determines whether the represented field contains (is made up of) binary data, instead of text data.
Software can identify fields to be displayed because they are human readable if this method returns false.

Specified by:
isBinary in interface TagField
Overrides:
isBinary in class Mp4TagBinaryField
Returns:
true if field represents binary data (not human readable).

toString

public java.lang.String toString()
Description copied from interface: TagField
This method returns a human readable description of the fields contents.
For text fields it should be the text itself. Other fields containing images may return a formatted string with image properties like width, height and so on.

Specified by:
toString in interface TagField
Overrides:
toString in class java.lang.Object
Returns:
Description of the fields content.