org.jaudiotagger.tag.id3.framebody
Class AbstractID3v2FrameBody

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
Direct Known Subclasses:
AbstractFrameBodyTextInfo, AbstractFrameBodyUrlLink, FrameBodyAENC, FrameBodyAPIC, FrameBodyASPI, FrameBodyCHAP, FrameBodyCOMM, FrameBodyCOMR, FrameBodyCRM, FrameBodyCTOC, FrameBodyDeprecated, FrameBodyENCR, FrameBodyEQU2, FrameBodyEQUA, FrameBodyETCO, FrameBodyGEOB, FrameBodyGRID, FrameBodyIPLS, FrameBodyLINK, FrameBodyMCDI, FrameBodyMLLT, FrameBodyOWNE, FrameBodyPCNT, FrameBodyPIC, FrameBodyPOPM, FrameBodyPOSS, FrameBodyPRIV, FrameBodyRBUF, FrameBodyRVA2, FrameBodyRVAD, FrameBodyRVRB, FrameBodySEEK, FrameBodySIGN, FrameBodySYLT, FrameBodySYTC, FrameBodyTPOS, FrameBodyTRCK, FrameBodyUFID, FrameBodyUnsupported, FrameBodyUSER, FrameBodyUSLT

public abstract class AbstractID3v2FrameBody
extends AbstractTagFrameBody

Contains the content for an ID3v2 frame, (the header is held directly within the frame


Field Summary
private  int size
          Frame Body Size, originally this is size as indicated in frame header when we come to writing data we recalculate it.
protected static java.lang.String 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 AbstractID3v2FrameBody()
          Create Empty Body.
protected AbstractID3v2FrameBody(AbstractID3v2FrameBody copyObject)
          Create Body based on another body
protected AbstractID3v2FrameBody(java.nio.ByteBuffer byteBuffer, int frameSize)
          Creates a new FrameBody datatype from file.
 
Method Summary
 void createStructure()
          Return String Representation of Datatype *
 boolean equals(java.lang.Object obj)
          Are two bodies equal
abstract  java.lang.String getIdentifier()
          Return the ID3v2 Frame Identifier, must be implemented by concrete subclasses
 int getSize()
          Return size of frame body,if framebody already exist will take this value from the frame header but it is always recalculated before writing any changes back to disk.
 void read(java.nio.ByteBuffer byteBuffer)
          This reads a frame body from a ByteBuffer into the appropriate FrameBody class and update the position of the buffer to be just after the end of this framebody

The ByteBuffer represents the tag and its position should be at the start of this framebody.

 void setSize()
          Set size based on size of the DataTypes making up the body,done after write
 void setSize(int size)
          Set size based on size passed as parameter from frame header, done before read
 void write(java.io.ByteArrayOutputStream tagBuffer)
          Write the contents of this datatype to the byte array
 
Methods inherited from class org.jaudiotagger.tag.id3.AbstractTagFrameBody
getBriefDescription, getHeader, getLongDescription, getObject, getObjectValue, getTextEncoding, isSubsetOf, iterator, setHeader, setObjectValue, setTextEncoding, setupObjectList, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_BODY

protected static final java.lang.String TYPE_BODY
See Also:
Constant Field Values

size

private int size
Frame Body Size, originally this is size as indicated in frame header when we come to writing data we recalculate it.

Constructor Detail

AbstractID3v2FrameBody

protected AbstractID3v2FrameBody()
Create Empty Body. Super Constructor sets up Object list


AbstractID3v2FrameBody

protected AbstractID3v2FrameBody(AbstractID3v2FrameBody copyObject)
Create Body based on another body

Parameters:
copyObject -

AbstractID3v2FrameBody

protected AbstractID3v2FrameBody(java.nio.ByteBuffer byteBuffer,
                                 int frameSize)
                          throws InvalidTagException
Creates a new FrameBody datatype from file. The super Constructor sets up the Object list for the frame.

Parameters:
byteBuffer - from where to read the frame body from
frameSize -
Throws:
InvalidTagException
Method Detail

getIdentifier

public abstract java.lang.String getIdentifier()
Return the ID3v2 Frame Identifier, must be implemented by concrete subclasses

Specified by:
getIdentifier in class AbstractTagItem
Returns:
the frame identifier

getSize

public int getSize()
Return size of frame body,if framebody already exist will take this value from the frame header but it is always recalculated before writing any changes back to disk.

Overrides:
getSize in class AbstractTagFrameBody
Returns:
size in bytes of this frame body

setSize

public void setSize(int size)
Set size based on size passed as parameter from frame header, done before read

Parameters:
size -

setSize

public void setSize()
Set size based on size of the DataTypes making up the body,done after write


equals

public boolean equals(java.lang.Object obj)
Are two bodies equal

Overrides:
equals in class AbstractTagFrameBody
Parameters:
obj -
Returns:
true if this datatype and its entire MP3Object array list equals the argument.

read

public void read(java.nio.ByteBuffer byteBuffer)
          throws InvalidTagException
This reads a frame body from a ByteBuffer into the appropriate FrameBody class and update the position of the buffer to be just after the end of this framebody

The ByteBuffer represents the tag and its position should be at the start of this framebody. The size as indicated in the header is passed to the frame constructor when reading from file.

Specified by:
read in class AbstractTagItem
Parameters:
byteBuffer - file to read
Throws:
InvalidFrameException - if unable to construct a framebody from the ByteBuffer
InvalidTagException

write

public void write(java.io.ByteArrayOutputStream tagBuffer)
Write the contents of this datatype to the byte array

Parameters:
tagBuffer -
Throws:
java.io.IOException - on any I/O error

createStructure

public void createStructure()
Return String Representation of Datatype *

Overrides:
createStructure in class AbstractTagFrameBody