org.jaudiotagger.tag.id3.framebody
Class AbstractFrameBodyTextInfo

java.lang.Object
  extended by org.jaudiotagger.tag.id3.AbstractTagItem
      extended by org.jaudiotagger.tag.id3.AbstractTagFrameBody
          extended by org.jaudiotagger.tag.id3.framebody.AbstractID3v2FrameBody
              extended by org.jaudiotagger.tag.id3.framebody.AbstractFrameBodyTextInfo
Direct Known Subclasses:
FrameBodyTALB, FrameBodyTBPM, FrameBodyTCMP, FrameBodyTCOM, FrameBodyTCON, FrameBodyTCOP, FrameBodyTDAT, FrameBodyTDEN, FrameBodyTDLY, FrameBodyTDOR, FrameBodyTDRC, FrameBodyTDRL, FrameBodyTDTG, FrameBodyTENC, FrameBodyTEXT, FrameBodyTFLT, FrameBodyTIME, FrameBodyTIPL, FrameBodyTIT1, FrameBodyTIT2, FrameBodyTIT3, FrameBodyTKEY, FrameBodyTLAN, FrameBodyTLEN, FrameBodyTMCL, FrameBodyTMED, FrameBodyTMOO, FrameBodyTOAL, FrameBodyTOFN, FrameBodyTOLY, FrameBodyTOPE, FrameBodyTORY, FrameBodyTOWN, FrameBodyTPE1, FrameBodyTPE2, FrameBodyTPE3, FrameBodyTPE4, FrameBodyTPRO, FrameBodyTPUB, FrameBodyTRDA, FrameBodyTRSN, FrameBodyTRSO, FrameBodyTSIZ, FrameBodyTSO2, FrameBodyTSOA, FrameBodyTSOC, FrameBodyTSOP, FrameBodyTSOT, FrameBodyTSRC, FrameBodyTSSE, FrameBodyTSST, FrameBodyTXXX, FrameBodyTYER, FrameBodyXSOA, FrameBodyXSOP, FrameBodyXSOT

public abstract class AbstractFrameBodyTextInfo
extends AbstractID3v2FrameBody

Abstract representation of a Text Frame

The text information frames are often the most important frames, containing information like artist, album and more. There may only be one text information frame of its kind in an tag. In ID3v24 All text information frames supports multiple strings, stored as a null separated list, where null is represented by the termination code for the character encoding. All text frame identifiers begin with "T". Only text frame identifiers begin with "T", with the exception of the "TXXX" frame. All the text information frames have the following format:

Text encoding $xx Information

The list of valid text encodings increaded from two in ID3v23 to four in ID3v24

iTunes incorrectly writes null terminators at the end of every String, even though it only writes one String.

You can retrieve the first value without the null terminator using getFirstTextValue()


Field Summary
 
Fields inherited from class org.jaudiotagger.tag.id3.framebody.AbstractID3v2FrameBody
TYPE_BODY
 
Fields inherited from class org.jaudiotagger.tag.id3.AbstractTagFrameBody
objectList
 
Fields inherited from class org.jaudiotagger.tag.id3.AbstractTagItem
logger
 
Constructor Summary
protected AbstractFrameBodyTextInfo()
          Creates a new FrameBodyTextInformation datatype.
protected AbstractFrameBodyTextInfo(AbstractFrameBodyTextInfo body)
          Copy Constructor
protected AbstractFrameBodyTextInfo(java.nio.ByteBuffer byteBuffer, int frameSize)
          Creates a new FrameBodyTextInformation datatype from file.
protected AbstractFrameBodyTextInfo(byte textEncoding, java.lang.String text)
          Creates a new FrameBodyTextInformation datatype.
 
Method Summary
 void addTextValue(java.lang.String value)
          Add additional value to value
 java.lang.String getFirstTextValue()
          Get first value
 int getNumberOfValues()
           
 java.lang.String getText()
          Retrieve the complete Text String.
 java.lang.String getValueAtIndex(int index)
          Get value at index
 void setText(java.lang.String text)
          Set the Full Text String.
protected  void setupObjectList()
          Setup the Object List.
 void write(java.io.ByteArrayOutputStream tagBuffer)
          Because Text frames have a text encoding we need to check the text String does not contain characters that cannot be encoded in current encoding before we write data.
 
Methods inherited from class org.jaudiotagger.tag.id3.framebody.AbstractID3v2FrameBody
createStructure, equals, getIdentifier, getSize, read, setSize, setSize
 
Methods inherited from class org.jaudiotagger.tag.id3.AbstractTagFrameBody
getBriefDescription, getHeader, getLongDescription, getObject, getObjectValue, getTextEncoding, isSubsetOf, iterator, setHeader, setObjectValue, setTextEncoding, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractFrameBodyTextInfo

protected AbstractFrameBodyTextInfo()
Creates a new FrameBodyTextInformation datatype. The super.super Constructor sets up the Object list for the frame.


AbstractFrameBodyTextInfo

protected AbstractFrameBodyTextInfo(AbstractFrameBodyTextInfo body)
Copy Constructor

Parameters:
body - AbstractFrameBodyTextInformation

AbstractFrameBodyTextInfo

protected AbstractFrameBodyTextInfo(byte textEncoding,
                                    java.lang.String text)
Creates a new FrameBodyTextInformation datatype. This is used when user wants to create a new frame based on data in a user interface.

Parameters:
textEncoding - Specifys what encoding should be used to write text to file.
text - Specifies the text String.

AbstractFrameBodyTextInfo

protected AbstractFrameBodyTextInfo(java.nio.ByteBuffer byteBuffer,
                                    int frameSize)
                             throws InvalidTagException
Creates a new FrameBodyTextInformation datatype from file.

The super.super Constructor sets up the Object list for the frame.

Parameters:
byteBuffer -
frameSize -
Throws:
InvalidTagException - if unable to create framebody from buffer
Method Detail

setText

public void setText(java.lang.String text)
Set the Full Text String.

If this String contains null terminator characters these are parsed as value seperators, allowing you to hold multiple strings within one text frame. This functionality is only officially support in ID3v24.

Parameters:
text - to set

getText

public java.lang.String getText()
Retrieve the complete Text String.

Returns:
the text string

getFirstTextValue

public java.lang.String getFirstTextValue()
Get first value

Returns:
value at index 0

getValueAtIndex

public java.lang.String getValueAtIndex(int index)
Get value at index

Parameters:
index -
Returns:
value at index

addTextValue

public void addTextValue(java.lang.String value)
Add additional value to value

Parameters:
value - at index

getNumberOfValues

public int getNumberOfValues()
Returns:
number of text values, usually one

write

public void write(java.io.ByteArrayOutputStream tagBuffer)
Because Text frames have a text encoding we need to check the text String does not contain characters that cannot be encoded in current encoding before we write data. If there are change the text encoding.

Overrides:
write in class AbstractID3v2FrameBody

setupObjectList

protected void setupObjectList()
Setup the Object List. All text frames contain a text encoding and then a text string.

TODO:would like to make final but cannnot because overriden by FrameBodyTXXX

Specified by:
setupObjectList in class AbstractTagFrameBody