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

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.GenericFrame
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
MetaFrame

public class GenericFrame
extends BaseFrame
implements java.io.Serializable, java.lang.Cloneable

This class is the generic ID3v2 frame type; it just takes the raw data from an ID3v2 tag and stores it as a byte array.

Version:
1.0d1 $Date: 2002/10/11 00:57:30 $
Author:
Daniel M. Zimmerman
See Also:
Serialized Form

Field Summary
private  byte[] frameData
          The data contained in this frame.
 
Constructor Summary
protected GenericFrame()
          Constructs a new GenericFrame with no data, and no valid frame type.
  GenericFrame(FrameHeader header)
          Constructs a new GenericFrame with the given header.
  GenericFrame(FrameHeader header, byte[] frameData)
          Constructs a new GenericFrame with the specified header and data.
 
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.
protected  byte[] getBytes()
          Get the frameData byte array.
 byte[] getRawData()
          Returns the raw data corresponding to this frame.
 boolean isOfRepeatableType()
          Returns true if it is legal for multiple frames of this type to exist in the same ID3v2 tag, false otherwise.
 void setRawData(byte[] rawData)
          Sets the raw data corresponding to this frame.
 java.lang.String toString()
          Returns a String representation of this frame.
 
Methods inherited from class com.tffenterprises.music.tag.id3v2.frame.BaseFrame
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

frameData

private byte[] frameData
The data contained in this frame.

Constructor Detail

GenericFrame

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


GenericFrame

public GenericFrame(FrameHeader header)
Constructs a new GenericFrame with the given header.

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

GenericFrame

public GenericFrame(FrameHeader header,
                    byte[] frameData)
             throws java.lang.IllegalArgumentException
Constructs a new GenericFrame with the specified header and data.

Parameters:
header - The FrameHeader instance to be used for this frame.
frameData - The frame data.
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.

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 java.lang.IllegalArgumentException
Sets the raw data corresponding to this frame.

Specified by:
setRawData in class BaseFrame
Parameters:
rawData - The raw data.
Throws:
java.lang.IllegalArgumentException - if the specified raw data is null.

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.

isOfRepeatableType

public boolean isOfRepeatableType()
Returns true if it is legal for multiple frames of this type to exist in the same ID3v2 tag, false otherwise.

Overrides:
isOfRepeatableType in class BaseFrame
Returns:
true if this frame can coexist with others of its type.

getBytes

protected byte[] getBytes()
Get the frameData byte array. To be used by subclasses only.

Overrides:
getBytes in class BaseFrame
Returns:
the frameData byte array.