org.jaudiotagger.audio.asf.tag
Class AsfTagField

java.lang.Object
  extended by org.jaudiotagger.audio.asf.tag.AsfTagField
All Implemented Interfaces:
java.lang.Cloneable, TagField
Direct Known Subclasses:
AbstractAsfTagImageField, AsfTagTextField

public class AsfTagField
extends java.lang.Object
implements TagField, java.lang.Cloneable

This class encapsulates a MetadataDescriptorand provides access to it.
The metadata descriptor used for construction is copied.

Author:
Christian Laireiter (liree)

Field Summary
protected  MetadataDescriptor toWrap
          This descriptor is wrapped.
 
Constructor Summary
AsfTagField(AsfFieldKey field)
          Creates a tag field.
AsfTagField(MetadataDescriptor source)
          Creates an instance.
AsfTagField(java.lang.String fieldKey)
          Creates a tag field.
 
Method Summary
 java.lang.Object clone()
          
 void copyContent(TagField field)
          This method copies the data of the given field to the current data.
 MetadataDescriptor getDescriptor()
          Returns the wrapped metadata descriptor (which actually stores the values).
 java.lang.String getId()
          Returns the Id of the represented tag field.
This value should uniquely identify a kind of tag data, like title.
 byte[] getRawContent()
          This method delivers the binary representation of the fields data in order to be directly written to the file.
 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.
 void isBinary(boolean value)
          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.

 boolean isEmpty()
          Determines whether the content of the field is empty.
 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 java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

toWrap

protected MetadataDescriptor toWrap
This descriptor is wrapped.

Constructor Detail

AsfTagField

public AsfTagField(AsfFieldKey field)
Creates a tag field.

Parameters:
field - the ASF field that should be represented.

AsfTagField

public AsfTagField(MetadataDescriptor source)
Creates an instance.

Parameters:
source - The descriptor which should be represented as a TagField.

AsfTagField

public AsfTagField(java.lang.String fieldKey)
Creates a tag field.

Parameters:
fieldKey - The field identifier to use.
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException

Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

copyContent

public void copyContent(TagField field)
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.

getDescriptor

public MetadataDescriptor getDescriptor()
Returns the wrapped metadata descriptor (which actually stores the values).

Returns:
the wrapped metadata descriptor

getId

public java.lang.String getId()
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:
Unique identifier for the fields type. (title, artist...)

getRawContent

public byte[] getRawContent()
This method delivers the binary representation of the fields data in order to be directly written to the file.

Specified by:
getRawContent in interface TagField
Returns:
Binary data representing the current tag field.

isBinary

public 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.

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

isBinary

public void isBinary(boolean value)
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:
value - 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()
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.

isEmpty

public boolean isEmpty()
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).

toString

public java.lang.String toString()
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.