com.tffenterprises.music.tag.id3v2.frame
Class TextFrame

java.lang.Object
  extended by com.tffenterprises.music.tag.id3v2.Frame
      extended by com.tffenterprises.music.tag.id3v2.frame.BaseFrame
          extended by com.tffenterprises.music.tag.id3v2.frame.TextBasedFrame
              extended by com.tffenterprises.music.tag.id3v2.frame.TextFrame
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
ContentTypeFrame, FractionFrame, YearFrame

public class TextFrame
extends TextBasedFrame
implements java.io.Serializable, java.lang.Cloneable

This class is the ID3v2 "Text Information Frame" frame type; it handles all types of text frames, though it does so in a generic fashion. Text frames which need specific types of parsing are handled by subclasses of this class. The data of a text frame, as far as this class is concerned, is a single string (either Unicode or ISO-8859-1).

Version:
1.0d1 $Date: 2003/03/16 18:52:30 $
Author:
Guillaume Lessard, Daniel M. Zimmerman
See Also:
Serialized Form

Field Summary
private  java.lang.String frameText
          The data contained in this frame.
 
Fields inherited from class com.tffenterprises.music.tag.id3v2.frame.TextBasedFrame
BOM_CHAR, BOM_CHAR_STRING, ENCODING_STRINGS, ISO_8859_1, NULL_BOM_STRING, NULL_CHAR, NULL_CHAR_STRING, UNICODE, UNICODE_BIG, UNICODE_LITTLE, UTF8
 
Constructor Summary
TextFrame()
          Constructs a new TextFrame with no data, and no valid frame type.
TextFrame(FrameHeader header)
          Constructs a new TextFrame with the specified frame header and no text.
TextFrame(FrameHeader header, java.lang.String frameText)
          Constructs a new TextFrame with the specified frame header and text.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this ID3v2 frame.
 boolean equals(java.lang.Object other)
          Compares this ID3v2 frame with another object.
 byte[] getRawData()
          Returns the raw data corresponding to this frame.
 java.lang.String getText()
          Returns the text contained in this frame.
 boolean isOfRepeatableType()
          Returns whether it is correct for multiple frames of this type to coexist in the same ID3v2 tag.
 void setRawData(byte[] rawData)
          Sets the raw data corresponding to this frame.
 void setText(java.lang.String frameText)
          Sets the text contained in this frame.
 java.lang.String toString()
          Returns a String representation of this frame.
 
Methods inherited from class com.tffenterprises.music.tag.id3v2.frame.TextBasedFrame
getNullBytes, getTextEncoding, getTextEncoding, getTextEncoding, is8859String, read8859Characters, read8859String, readCharacters, readString, readUnicodeCharacters, readUnicodeString
 
Methods inherited from class com.tffenterprises.music.tag.id3v2.frame.BaseFrame
getBytes, getChecksum, getFormatFlags, getFrameID, getHeader, getStatusFlags, hashCode, isChanged, setChanged, setFormatFlags, setStatusFlags, toByteArray, updateChecksum, writeTo
 
Methods inherited from class com.tffenterprises.music.tag.id3v2.Frame
FromByteArray, FromByteArray, FromInputStream, GetFrameClassForID, getNewInstance, getNewInstance, getNewInstance, MinimumLength, RegisterFrameClass, UnregisterFrameClass
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

frameText

private java.lang.String frameText
The data contained in this frame.

Constructor Detail

TextFrame

TextFrame()
Constructs a new TextFrame with no data, and no valid frame type.


TextFrame

public TextFrame(FrameHeader header)
Constructs a new TextFrame with the specified frame header and no text.

Parameters:
header - The FrameHeader instance to be used for this TextFrame.

TextFrame

public TextFrame(FrameHeader header,
                 java.lang.String frameText)
          throws java.lang.IllegalArgumentException
Constructs a new TextFrame with the specified frame header and text.

Parameters:
header - The FrameHeader instance to be used for this TextFrame.
frameText - The frame text.
Throws:
java.lang.IllegalArgumentException - if the specified frame data is null.
Method Detail

clone

public java.lang.Object clone()
Returns a clone of this ID3v2 frame.

Overrides:
clone in class BaseFrame
Returns:
a clone of this ID3v2 frame.

equals

public boolean equals(java.lang.Object other)
Compares this ID3v2 frame with another object.

Overrides:
equals in class BaseFrame
Parameters:
other - The other object.
Returns:
true if the two objects are equivalent, false otherwise.

toString

public java.lang.String toString()
Returns a String representation of this frame.

Overrides:
toString in class BaseFrame
Returns:
a String representation of this frame.

getRawData

public byte[] getRawData()
Returns the raw data corresponding to this frame. This does not include the frame header.

Specified by:
getRawData in class BaseFrame
Returns:
the raw data corresponding to this frame.

setRawData

public void setRawData(byte[] rawData)
                throws FrameDataFormatException,
                       java.lang.IllegalArgumentException
Sets the raw data corresponding to this frame. This method converts the entire frame to a single String, then passes this to the setText(String) method, which should perform the parsing for TextFrame subclasses.

Specified by:
setRawData in class BaseFrame
Parameters:
rawData - The raw data.
Throws:
FrameDataFormatException - if the raw data is not in an appropriate format for this frame's type.
java.lang.IllegalArgumentException - if the specified raw data is null.

isOfRepeatableType

public boolean isOfRepeatableType()
Returns whether it is correct for multiple frames of this type to coexist in the same ID3v2 tag. Since the class TextFrame is supposed to represent the so-called "Text Information Frames" of ID3v2, this will return false; those frames cannot exist in multiple copies in a given tag.

Overrides:
isOfRepeatableType in class BaseFrame
Returns:
false, since Text Information Frames cannot be repeated.

getText

public java.lang.String getText()
Returns the text contained in this frame.

Returns:
the text contained in this frame.

setText

public void setText(java.lang.String frameText)
Sets the text contained in this frame.

Parameters:
frameText - The text.
Throws:
java.lang.IllegalArgumentException - if the text is null.