org.jaudiotagger.tag.datatype
Class TextEncodedStringNullTerminated

java.lang.Object
  extended by org.jaudiotagger.tag.datatype.AbstractDataType
      extended by org.jaudiotagger.tag.datatype.AbstractString
          extended by org.jaudiotagger.tag.datatype.TextEncodedStringNullTerminated
Direct Known Subclasses:
StringNullTerminated

public class TextEncodedStringNullTerminated
extends AbstractString

Represents a String whose size is determined by finding of a null character at the end of the String.

The String itself might be of length zero (i.e just consist of the null character). The String will be encoded based upon the text encoding of the frame that it belongs to.


Field Summary
 
Fields inherited from class org.jaudiotagger.tag.datatype.AbstractDataType
frameBody, identifier, logger, size, TYPE_ELEMENT, value
 
Constructor Summary
TextEncodedStringNullTerminated(java.lang.String identifier, AbstractTagFrameBody frameBody)
          Creates a new TextEncodedStringNullTerminated datatype.
TextEncodedStringNullTerminated(java.lang.String identifier, AbstractTagFrameBody frameBody, java.lang.String value)
          Creates a new TextEncodedStringNullTerminated datatype, with value
TextEncodedStringNullTerminated(TextEncodedStringNullTerminated object)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
protected  java.lang.String getTextEncodingCharSet()
           
 void readByteArray(byte[] arr, int offset)
          Read a string from buffer upto null character (if exists)

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.

 byte[] writeByteArray()
          Write String into byte array, adding a null character to the end of the String
 
Methods inherited from class org.jaudiotagger.tag.datatype.AbstractString
canBeEncoded, getSize, setSize, toString
 
Methods inherited from class org.jaudiotagger.tag.datatype.AbstractDataType
createStructure, getBody, getIdentifier, getValue, readByteArray, setBody, setValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextEncodedStringNullTerminated

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

Parameters:
identifier - identifies the frame type
frameBody -

TextEncodedStringNullTerminated

public TextEncodedStringNullTerminated(java.lang.String identifier,
                                       AbstractTagFrameBody frameBody,
                                       java.lang.String value)
Creates a new TextEncodedStringNullTerminated datatype, with value

Parameters:
identifier -
frameBody -
value -

TextEncodedStringNullTerminated

public TextEncodedStringNullTerminated(TextEncodedStringNullTerminated 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 string from buffer upto null character (if exists)

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:
InvalidDataTypeException

writeByteArray

public byte[] writeByteArray()
Write String into byte array, adding a null character to the end of the String

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()