org.jaudiotagger.tag.datatype
Class PartOfSet

java.lang.Object
  extended by org.jaudiotagger.tag.datatype.AbstractDataType
      extended by org.jaudiotagger.tag.datatype.AbstractString
          extended by org.jaudiotagger.tag.datatype.PartOfSet

public class PartOfSet
extends AbstractString

Represents the form 01/10 whereby the second part is optional. This is used by frame such as TRCK and TPOS Some applications like to prepend the count with a zero to aid sorting, (i.e 02 comes before 10)


Nested Class Summary
static class PartOfSet.PartOfSetValue
          Holds data
 
Field Summary
 
Fields inherited from class org.jaudiotagger.tag.datatype.AbstractDataType
frameBody, identifier, logger, size, TYPE_ELEMENT, value
 
Constructor Summary
PartOfSet(PartOfSet object)
          Copy constructor
PartOfSet(java.lang.String identifier, AbstractTagFrameBody frameBody)
          Creates a new empty PartOfSet datatype.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
protected  java.lang.String getTextEncodingCharSet()
          Get the text encoding being used.
 PartOfSet.PartOfSetValue getValue()
          Get value held by this Object
 void readByteArray(byte[] arr, int offset)
          Read a 'n' bytes from buffer into a String where n is the framesize - offset so thefore cannot use this if there are other objects after it because it has no delimiter.
 java.lang.String toString()
          Return String representation of datatype
 byte[] writeByteArray()
          Write String into byte array

It will remove a trailing null terminator if exists if the option RemoveTrailingTerminatorOnWrite has been set.

 
Methods inherited from class org.jaudiotagger.tag.datatype.AbstractString
canBeEncoded, getSize, setSize
 
Methods inherited from class org.jaudiotagger.tag.datatype.AbstractDataType
createStructure, getBody, getIdentifier, readByteArray, setBody, setValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PartOfSet

public PartOfSet(java.lang.String identifier,
                 AbstractTagFrameBody frameBody)
Creates a new empty PartOfSet datatype.

Parameters:
identifier - identifies the frame type
frameBody -

PartOfSet

public PartOfSet(PartOfSet object)
Copy constructor

Parameters:
object -
Method Detail

equals

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

readByteArray

public void readByteArray(byte[] arr,
                          int offset)
                   throws InvalidDataTypeException
Read a 'n' bytes from buffer into a String where n is the framesize - offset so thefore cannot use this if there are other objects after it because it has no delimiter.

Must take into account the text encoding defined in the Encoding Object ID3 Text Frames often allow multiple strings seperated by the null char appropriate for the encoding.

Specified by:
readByteArray in class AbstractDataType
Parameters:
arr - this is the buffer for the frame
offset - this is where to start reading in the buffer for this field
Throws:
java.lang.NullPointerException
java.lang.IndexOutOfBoundsException
InvalidDataTypeException

writeByteArray

public byte[] writeByteArray()
Write String into byte array

It will remove a trailing null terminator if exists if the option RemoveTrailingTerminatorOnWrite has been set.

Specified by:
writeByteArray in class AbstractDataType
Returns:
the data as a byte array in format to write to file

getTextEncodingCharSet

protected java.lang.String getTextEncodingCharSet()
Get the text encoding being used.

The text encoding is defined by the frame body that the text field belongs to.

Returns:
the text encoding charset

getValue

public PartOfSet.PartOfSetValue getValue()
Description copied from class: AbstractDataType
Get value held by this Object

Overrides:
getValue in class AbstractDataType
Returns:
value held by this Object

toString

public java.lang.String toString()
Description copied from class: AbstractString
Return String representation of datatype

Overrides:
toString in class AbstractString
Returns:
a string representation of the value