org.jaudiotagger.tag.datatype
Class AbstractDataType

java.lang.Object
  extended by org.jaudiotagger.tag.datatype.AbstractDataType
Direct Known Subclasses:
AbstractString, BooleanByte, BooleanString, ByteArraySizeTerminated, GroupRepeated, ID3v2LyricLine, Lyrics3Image, Lyrics3Line, Lyrics3TimeStamp, MultipleTextEncodedStringNullTerminated, NumberFixedLength, NumberVariableLength

public abstract class AbstractDataType
extends java.lang.Object

Represents a field/data type that can be held within a frames body, these map loosely onto Section 4. ID3v2 frame overview at http://www.id3.org/id3v2.4.0-structure.txt


Field Summary
static java.util.logging.Logger logger
           
 
Constructor Summary
AbstractDataType(AbstractDataType copyObject)
          This is used by subclasses, to clone the data within the copyObject TODO:It seems to be missing some of the more complex value types.
 
Method Summary
 void createStructure()
          Return String Representation of Datatype *
 boolean equals(java.lang.Object obj)
           
 AbstractTagFrameBody getBody()
          Get the framebody associated with this datatype
 java.lang.String getIdentifier()
          Return the key as declared by the frame bodies datatype list
abstract  int getSize()
          This defines the size in bytes of the datatype being held when read/written to file.
 java.lang.Object getValue()
          Get value held by this Object
 void readByteArray(byte[] arr)
          Simplified wrapper for reading bytes from file into Object.
abstract  void readByteArray(byte[] arr, int offset)
          This is the starting point for reading bytes from the file into the ID3 datatype starting at offset.
 void setBody(AbstractTagFrameBody frameBody)
          Set the framebody that this datatype is associated with
 void setValue(java.lang.Object value)
          Set the value held by this datatype, this is used typically used when the user wants to modify the value in an existing frame.
abstract  byte[] writeByteArray()
          Starting point write ID3 Datatype back to array of bytes.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static java.util.logging.Logger logger
Constructor Detail

AbstractDataType

public AbstractDataType(AbstractDataType copyObject)
This is used by subclasses, to clone the data within the copyObject TODO:It seems to be missing some of the more complex value types.

Method Detail

setBody

public void setBody(AbstractTagFrameBody frameBody)
Set the framebody that this datatype is associated with

Parameters:
frameBody -

getBody

public AbstractTagFrameBody getBody()
Get the framebody associated with this datatype

Returns:
the framebody that this datatype is associated with

getIdentifier

public java.lang.String getIdentifier()
Return the key as declared by the frame bodies datatype list

Returns:
the key used to reference this datatype from a framebody

setValue

public void setValue(java.lang.Object value)
Set the value held by this datatype, this is used typically used when the user wants to modify the value in an existing frame.

Parameters:
value -

getValue

public java.lang.Object getValue()
Get value held by this Object

Returns:
value held by this Object

readByteArray

public final void readByteArray(byte[] arr)
                         throws InvalidDataTypeException
Simplified wrapper for reading bytes from file into Object. Used for reading Strings, this class should be overridden for non String Objects

Parameters:
arr -
Throws:
InvalidDataTypeException

getSize

public abstract int getSize()
This defines the size in bytes of the datatype being held when read/written to file.

Returns:
the size in bytes of the datatype

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
Parameters:
obj -
Returns:
whether this and obj are deemed equivalent

readByteArray

public abstract void readByteArray(byte[] arr,
                                   int offset)
                            throws InvalidDataTypeException
This is the starting point for reading bytes from the file into the ID3 datatype starting at offset. This class must be overridden

Parameters:
arr -
offset -
Throws:
InvalidDataTypeException

writeByteArray

public abstract byte[] writeByteArray()
Starting point write ID3 Datatype back to array of bytes. This class must be overridden.

Returns:
the array of bytes representing this datatype that should be written to file

createStructure

public void createStructure()
Return String Representation of Datatype *