org.jaudiotagger.tag.mp4.field
Class Mp4TagTextField

java.lang.Object
  extended by org.jaudiotagger.tag.mp4.Mp4TagField
      extended by org.jaudiotagger.tag.mp4.field.Mp4TagTextField
All Implemented Interfaces:
TagField, TagTextField
Direct Known Subclasses:
Mp4TagByteField, Mp4TagTextNumberField

public class Mp4TagTextField
extends Mp4TagField
implements TagTextField

Represents a single text field

Mp4 metadata normally held as follows:

 MP4Box Parent contains
      :length (includes length of data child)  (4 bytes)
      :name         (4 bytes)
      :child with
          :length          (4 bytes)
          :name 'Data'     (4 bytes)
          :atom version    (1 byte)
          :atom type flags (3 bytes)
          :null field      (4 bytes)
          :data
 

Note:This class is initilized with the child data atom only, the parent data has already been processed, this may change as it seems that code should probably be enscapulated into this. Whereas the raw content returned by the getRawContent() contais the byte data for parent and child.


Field Summary
 
Fields inherited from class org.jaudiotagger.tag.mp4.Mp4TagField
logger
 
Constructor Summary
Mp4TagTextField(java.lang.String id, java.nio.ByteBuffer data)
          Construct from File
Mp4TagTextField(java.lang.String id, java.lang.String content)
          Construct new Field
 
Method Summary
 void copyContent(TagField field)
          This method copies the data of the given field to the current data.
 java.lang.String getContent()
          Returns the content of the field.
 java.lang.String getEncoding()
          Returns the current used charset encoding.
 Mp4FieldType getFieldType()
           
 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.
 boolean isEmpty()
          Determines whether the content of the field is empty.
 void setContent(java.lang.String s)
          Sets the content of the field.
 void setEncoding(java.lang.String s)
          Sets the charset encoding used by the field.
 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.Mp4TagField
getId, getRawContent, getRawContentDataOnly, isBinary, isCommon
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jaudiotagger.tag.TagField
getId, getRawContent, isBinary, isCommon
 

Constructor Detail

Mp4TagTextField

public Mp4TagTextField(java.lang.String id,
                       java.nio.ByteBuffer data)
                throws java.io.UnsupportedEncodingException
Construct from File

Parameters:
id - parent id
data - atom data
Throws:
java.io.UnsupportedEncodingException

Mp4TagTextField

public Mp4TagTextField(java.lang.String id,
                       java.lang.String content)
Construct new Field

Parameters:
id - parent id
content - data atom data
Method Detail

copyContent

public void copyContent(TagField field)
Description copied from interface: TagField
This method copies the data of the given field to the current data.

Specified by:
copyContent in interface TagField
Parameters:
field - The field containing the data to be taken.

getContent

public java.lang.String getContent()
Description copied from interface: TagTextField
Returns the content of the field.

Specified by:
getContent in interface TagTextField
Returns:
Content

getFieldType

public Mp4FieldType getFieldType()
Specified by:
getFieldType in class Mp4TagField
Returns:
the field type of this field

getEncoding

public java.lang.String getEncoding()
Description copied from interface: TagTextField
Returns the current used charset encoding.

Specified by:
getEncoding in interface TagTextField
Returns:
Charset encoding.

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
Returns:
true if field represents binary data (not human readable).

isEmpty

public boolean isEmpty()
Description copied from interface: TagField
Determines whether the content of the field is empty.

Specified by:
isEmpty in interface TagField
Returns:
true if no data is stored (or empty String).

setContent

public void setContent(java.lang.String s)
Description copied from interface: TagTextField
Sets the content of the field.

Specified by:
setContent in interface TagTextField
Parameters:
s - fields content.

setEncoding

public void setEncoding(java.lang.String s)
Description copied from interface: TagTextField
Sets the charset encoding used by the field.

Specified by:
setEncoding in interface TagTextField
Parameters:
s - charset.

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.