org.jaudiotagger.tag.mp4
Class Mp4TagField

java.lang.Object
  extended by org.jaudiotagger.tag.mp4.Mp4TagField
All Implemented Interfaces:
TagField
Direct Known Subclasses:
Mp4TagBinaryField, Mp4TagRawBinaryField, Mp4TagReverseDnsField, Mp4TagTextField

public abstract class Mp4TagField
extends java.lang.Object
implements TagField

This abstract class represents a link between piece of data, and how it is stored as an mp4 atom

Note there isnt a one to one correspondance between a tag field and a box because some fields are represented by multiple boxes, for example many of the MusicBrainz fields use the '----' box, which in turn uses one of mean, name and data box. So an instance of a tag field maps to one item of data such as 'Title', but it may have to read multiple boxes to do this.

There are various subclasses that represent different types of fields


Field Summary
protected  java.lang.String id
           
static java.util.logging.Logger logger
           
protected  Mp4BoxHeader parentHeader
           
 
Constructor Summary
protected Mp4TagField(java.nio.ByteBuffer data)
          Used by subclasses that canot identify their id until after they have been built such as ReverseDnsField
protected Mp4TagField(Mp4BoxHeader parentHeader, java.nio.ByteBuffer data)
          Used by reverese dns when reading from file, so can identify when there is a data atom
protected Mp4TagField(java.lang.String id)
           
protected Mp4TagField(java.lang.String id, java.nio.ByteBuffer data)
           
 
Method Summary
protected abstract  void build(java.nio.ByteBuffer data)
          Processes the data and sets the position of the data buffer to just after the end of this fields data ready for processing next field.
protected abstract  byte[] getDataBytes()
           
abstract  Mp4FieldType getFieldType()
           
 java.lang.String getId()
          Returns the Id of the represented tag field.
This value should uniquely identify a kind of tag data, like title.
protected  byte[] getIdBytes()
           
 byte[] getRawContent()
          Convert back to raw content, includes parent and data atom as views as one thing externally
 byte[] getRawContentDataOnly()
          Get raw content for the data component only
 void isBinary(boolean b)
          This method will set the field to represent binary data.

Some implementations may support conversions.
As of now (Octobre 2005) there is no implementation really using this method to perform useful operations.

 boolean isCommon()
          Identifies a field to be of common use.

Some software may differ between common and not common fields.

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jaudiotagger.tag.TagField
copyContent, isBinary, isEmpty, toString
 

Field Detail

logger

public static java.util.logging.Logger logger

id

protected java.lang.String id

parentHeader

protected Mp4BoxHeader parentHeader
Constructor Detail

Mp4TagField

protected Mp4TagField(java.lang.String id)

Mp4TagField

protected Mp4TagField(java.nio.ByteBuffer data)
               throws java.io.UnsupportedEncodingException
Used by subclasses that canot identify their id until after they have been built such as ReverseDnsField

Parameters:
data -
Throws:
java.io.UnsupportedEncodingException

Mp4TagField

protected Mp4TagField(Mp4BoxHeader parentHeader,
                      java.nio.ByteBuffer data)
               throws java.io.UnsupportedEncodingException
Used by reverese dns when reading from file, so can identify when there is a data atom

Parameters:
parentHeader -
data -
Throws:
java.io.UnsupportedEncodingException

Mp4TagField

protected Mp4TagField(java.lang.String id,
                      java.nio.ByteBuffer data)
               throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException
Method Detail

getId

public java.lang.String getId()
Description copied from interface: TagField
Returns the Id of the represented tag field.
This value should uniquely identify a kind of tag data, like title. AbstractTag will use the "id" to summarize multiple fields.

Specified by:
getId in interface TagField
Returns:
field identifier

isBinary

public void isBinary(boolean b)
Description copied from interface: TagField
This method will set the field to represent binary data.

Some implementations may support conversions.
As of now (Octobre 2005) there is no implementation really using this method to perform useful operations.

Specified by:
isBinary in interface TagField
Parameters:
b - true, if the field contains binary data. //@deprecated As for now is of no use. Implementations should use another // way of setting this property.

isCommon

public boolean isCommon()
Description copied from interface: TagField
Identifies a field to be of common use.

Some software may differ between common and not common fields. A common one is for sure the title field. A web link may not be of common use for tagging. However some file formats, or future development of users expectations will make more fields common than now can be known.

Specified by:
isCommon in interface TagField
Returns:
true if the field is of common use.

getIdBytes

protected byte[] getIdBytes()
Returns:
field identifier as it will be held within the file

getDataBytes

protected abstract byte[] getDataBytes()
                                throws java.io.UnsupportedEncodingException
Returns:
the data as it is held on file
Throws:
java.io.UnsupportedEncodingException

getFieldType

public abstract Mp4FieldType getFieldType()
Returns:
the field type of this field

build

protected abstract void build(java.nio.ByteBuffer data)
                       throws java.io.UnsupportedEncodingException
Processes the data and sets the position of the data buffer to just after the end of this fields data ready for processing next field.

Parameters:
data -
Throws:
java.io.UnsupportedEncodingException

getRawContent

public byte[] getRawContent()
                     throws java.io.UnsupportedEncodingException
Convert back to raw content, includes parent and data atom as views as one thing externally

Specified by:
getRawContent in interface TagField
Returns:
Throws:
java.io.UnsupportedEncodingException

getRawContentDataOnly

public byte[] getRawContentDataOnly()
                             throws java.io.UnsupportedEncodingException
Get raw content for the data component only

Returns:
Throws:
java.io.UnsupportedEncodingException