entagged.audioformats.ape.util
Class ApeTagField

java.lang.Object
  extended by entagged.audioformats.ape.util.ApeTagField
All Implemented Interfaces:
TagField
Direct Known Subclasses:
ApeTagBinaryField, ApeTagTextField

public abstract class ApeTagField
extends Object
implements TagField


Constructor Summary
ApeTagField(String id, boolean binary)
           
 
Method Summary
protected  void copy(byte[] src, byte[] dst, int dstOffset)
           
abstract  void copyContent(TagField field)
          This method copies the data of the given filed to the current data.
protected  byte[] getBytes(String s, String encoding)
           
 String getId()
          Returns the Id of the represented tag field.
This value should uniquely identify a kind of tag data, like title.
abstract  byte[] getRawContent()
          This method delivers the binary representation of the fields data in order to be directly written to the file.
protected  byte[] getSize(int size)
           
 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 mehtod returns false.
 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 implemenation 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.
abstract  boolean isEmpty()
          Determines whether the content of the field is empty.
abstract  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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ApeTagField

public ApeTagField(String id,
                   boolean binary)
Method Detail

getId

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

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 mehtod returns false.

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

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 implemenation really using this method to perform useful operations.

Specified by:
isBinary in interface TagField
Parameters:
b - true, if the field contains binary data.

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

copy

protected void copy(byte[] src,
                    byte[] dst,
                    int dstOffset)

getSize

protected byte[] getSize(int size)

getBytes

protected byte[] getBytes(String s,
                          String encoding)
                   throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

isEmpty

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

toString

public abstract 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 Object
Returns:
Description of the fields content.

copyContent

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

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

getRawContent

public abstract byte[] getRawContent()
                              throws UnsupportedEncodingException
Description copied from interface: TagField
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.
Throws:
UnsupportedEncodingException - Most tag data represents text. In some cases the underlying implementation will need to convert the text data in java to a specific charset encoding. In these cases an UnsupportedEncodingException may occur.


Copyright © 2007-2008. All Rights Reserved.