org.jaudiotagger.tag.id3
Class ID3v24Frame

java.lang.Object
  extended by org.jaudiotagger.tag.id3.AbstractTagItem
      extended by org.jaudiotagger.tag.id3.AbstractTagFrame
          extended by org.jaudiotagger.tag.id3.AbstractID3v2Frame
              extended by org.jaudiotagger.tag.id3.ID3v24Frame
All Implemented Interfaces:
TagField, TagTextField

public class ID3v24Frame
extends AbstractID3v2Frame

Represents an ID3v2.4 frame.

Version:
$Id: ID3v24Frame.java 925 2010-10-21 15:22:41Z paultaylor $
Author:
: Paul Taylor, : Eric Farng

Nested Class Summary
(package private)  class ID3v24Frame.EncodingFlags
          This represents a frame headers Encoding Flags
(package private)  class ID3v24Frame.StatusFlags
          Member Class This represents a frame headers Status Flags Make adjustments if necessary based on frame type and specification.
 
Field Summary
private  int encryptionMethod
          If the frame is encrypted then the encryption method is stored in this byte
protected static int FRAME_DATA_LENGTH_SIZE
           
protected static int FRAME_ENCRYPTION_INDICATOR_SIZE
           
protected static int FRAME_FLAGS_SIZE
           
protected static int FRAME_GROUPING_INDICATOR_SIZE
           
protected static int FRAME_HEADER_SIZE
           
protected static int FRAME_ID_SIZE
           
protected static int FRAME_SIZE_SIZE
           
private  int groupIdentifier
          If the frame belongs in a group with other frames then the group identifier byte is stored
private static java.util.regex.Pattern validFrameIdentifier
           
 
Fields inherited from class org.jaudiotagger.tag.id3.AbstractID3v2Frame
encodingFlags, frameSize, identifier, statusFlags, TYPE_FRAME, TYPE_FRAME_SIZE, UNSUPPORTED_ID
 
Fields inherited from class org.jaudiotagger.tag.id3.AbstractTagFrame
frameBody
 
Fields inherited from class org.jaudiotagger.tag.id3.AbstractTagItem
logger
 
Constructor Summary
ID3v24Frame()
           
ID3v24Frame(AbstractID3v2Frame frame)
          Creates a new ID3v2_4Frame datatype based on another frame of different version Converts the framebody to the equivalent v24 framebody or to UnsupportedFrameBody if identifier is unknown.
ID3v24Frame(java.nio.ByteBuffer byteBuffer)
          Deprecated. use ID3v24Frame(ByteBuffer,String) instead
ID3v24Frame(java.nio.ByteBuffer byteBuffer, java.lang.String loggingFilename)
          Creates a new ID3v24Frame datatype by reading from byteBuffer.
ID3v24Frame(ID3v24Frame frame)
          Copy Constructor:Creates a new ID3v2_4Frame datatype based on another frame.
ID3v24Frame(Lyrics3v2Field field)
          Creates a new ID3v2_4Frame datatype based on Lyrics3.
ID3v24Frame(java.lang.String identifier)
          Creates a new ID3v2_4Frame of type identifier.
 
Method Summary
private  void checkIfFrameSizeThatIsNotSyncSafe(java.nio.ByteBuffer byteBuffer)
          If frame is greater than certain size it will be decoded differently if unsynchronized to if synchronized Frames with certain byte sequences should be unsynchronized but sometimes editors do not unsynchronize them so this method checks both cases and goes with the option that fits best with the data
 void createStructure()
          Return String Representation of body
private  void createV24FrameFromV23Frame(ID3v23Frame frame)
           
 boolean equals(java.lang.Object obj)
          Returns true if this datatype and its body equals the argument and its body.
 AbstractID3v2Frame.EncodingFlags getEncodingFlags()
          Get Encoding Flags Object
 int getEncryptionMethod()
           
protected  int getFrameFlagsSize()
           
protected  int getFrameHeaderSize()
           
protected  int getFrameIdSize()
           
private  void getFrameSize(java.nio.ByteBuffer byteBuffer)
          Read the frame size form the header, check okay , if not try to fix or just throw exception
protected  int getFrameSizeSize()
           
 int getGroupIdentifier()
           
 int getSize()
          Return size of frame
 AbstractID3v2Frame.StatusFlags getStatusFlags()
          Get Status Flags Object
 boolean isBinary()
          Determines whether the represented field contains (is made up of) binary data, instead of text data.
Software can identify fields to be displayed because they are human readable if this method returns false.
 boolean isCommon()
          Identifies a field to be of common use.

Some software may differ between common and not common fields.

 boolean isValidID3v2FrameIdentifier(java.lang.String identifier)
          Does the frame identifier meet the syntax for a idv3v2 frame identifier.
 void read(java.nio.ByteBuffer byteBuffer)
          Read the frame from the specified file.
 void setEncoding(java.lang.String encoding)
          Sets the charset encoding used by the field.
 void write(java.io.ByteArrayOutputStream tagBuffer)
          Write the frame.
 
Methods inherited from class org.jaudiotagger.tag.id3.AbstractID3v2Frame
copyContent, getContent, getEncoding, getId, getIdentifier, getLoggingFilename, getRawContent, isBinary, isEmpty, isPadding, readBody, readBody, readEncryptedBody, readIdentifier, setContent, setLoggingFilename
 
Methods inherited from class org.jaudiotagger.tag.id3.AbstractTagFrame
getBody, isSubsetOf, setBody
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jaudiotagger.tag.TagField
toString
 

Field Detail

validFrameIdentifier

private static java.util.regex.Pattern validFrameIdentifier

FRAME_DATA_LENGTH_SIZE

protected static final int FRAME_DATA_LENGTH_SIZE
See Also:
Constant Field Values

FRAME_ID_SIZE

protected static final int FRAME_ID_SIZE
See Also:
Constant Field Values

FRAME_FLAGS_SIZE

protected static final int FRAME_FLAGS_SIZE
See Also:
Constant Field Values

FRAME_SIZE_SIZE

protected static final int FRAME_SIZE_SIZE
See Also:
Constant Field Values

FRAME_ENCRYPTION_INDICATOR_SIZE

protected static final int FRAME_ENCRYPTION_INDICATOR_SIZE
See Also:
Constant Field Values

FRAME_GROUPING_INDICATOR_SIZE

protected static final int FRAME_GROUPING_INDICATOR_SIZE
See Also:
Constant Field Values

FRAME_HEADER_SIZE

protected static final int FRAME_HEADER_SIZE
See Also:
Constant Field Values

encryptionMethod

private int encryptionMethod
If the frame is encrypted then the encryption method is stored in this byte


groupIdentifier

private int groupIdentifier
If the frame belongs in a group with other frames then the group identifier byte is stored

Constructor Detail

ID3v24Frame

public ID3v24Frame()

ID3v24Frame

public ID3v24Frame(java.lang.String identifier)
Creates a new ID3v2_4Frame of type identifier. An empty body of the correct type will be automatically created. This constructor should be used when wish to create a new frame from scratch using user input

Parameters:
identifier - defines the type of body to be created

ID3v24Frame

public ID3v24Frame(ID3v24Frame frame)
Copy Constructor:Creates a new ID3v2_4Frame datatype based on another frame.

Parameters:
frame -

ID3v24Frame

public ID3v24Frame(AbstractID3v2Frame frame)
            throws InvalidFrameException
Creates a new ID3v2_4Frame datatype based on another frame of different version Converts the framebody to the equivalent v24 framebody or to UnsupportedFrameBody if identifier is unknown.

Parameters:
frame - to construct a new frame from
Throws:
InvalidFrameException

ID3v24Frame

public ID3v24Frame(Lyrics3v2Field field)
            throws InvalidTagException
Creates a new ID3v2_4Frame datatype based on Lyrics3.

Parameters:
field -
Throws:
InvalidTagException

ID3v24Frame

public ID3v24Frame(java.nio.ByteBuffer byteBuffer,
                   java.lang.String loggingFilename)
            throws InvalidFrameException,
                   InvalidDataTypeException
Creates a new ID3v24Frame datatype by reading from byteBuffer.

Parameters:
byteBuffer - to read from
loggingFilename -
Throws:
InvalidFrameException
InvalidDataTypeException

ID3v24Frame

public ID3v24Frame(java.nio.ByteBuffer byteBuffer)
            throws InvalidFrameException,
                   InvalidDataTypeException
Deprecated. use ID3v24Frame(ByteBuffer,String) instead

Creates a new ID3v24Frame datatype by reading from byteBuffer.

Parameters:
byteBuffer - to read from
Throws:
InvalidFrameException
InvalidDataTypeException
Method Detail

getFrameIdSize

protected int getFrameIdSize()
Specified by:
getFrameIdSize in class AbstractID3v2Frame
Returns:
size in bytes of the frameid field

getFrameSizeSize

protected int getFrameSizeSize()
Specified by:
getFrameSizeSize in class AbstractID3v2Frame
Returns:
the size in bytes of the frame size field

getFrameFlagsSize

protected int getFrameFlagsSize()

getFrameHeaderSize

protected int getFrameHeaderSize()
Specified by:
getFrameHeaderSize in class AbstractID3v2Frame
Returns:
the size in bytes of the frame header

createV24FrameFromV23Frame

private void createV24FrameFromV23Frame(ID3v23Frame frame)
                                 throws InvalidFrameException
Throws:
InvalidFrameException

equals

public boolean equals(java.lang.Object obj)
Description copied from class: AbstractTagFrame
Returns true if this datatype and its body equals the argument and its body. this datatype is equal if and only if they are the same class and have the same getSubId id string.

Overrides:
equals in class AbstractID3v2Frame
Parameters:
obj -
Returns:
if obj is equivalent to this frame

getSize

public int getSize()
Return size of frame

Specified by:
getSize in class AbstractTagItem
Returns:
int frame size

checkIfFrameSizeThatIsNotSyncSafe

private void checkIfFrameSizeThatIsNotSyncSafe(java.nio.ByteBuffer byteBuffer)
                                        throws InvalidFrameException
If frame is greater than certain size it will be decoded differently if unsynchronized to if synchronized Frames with certain byte sequences should be unsynchronized but sometimes editors do not unsynchronize them so this method checks both cases and goes with the option that fits best with the data

Parameters:
byteBuffer -
Throws:
InvalidFrameException

getFrameSize

private void getFrameSize(java.nio.ByteBuffer byteBuffer)
                   throws InvalidFrameException
Read the frame size form the header, check okay , if not try to fix or just throw exception

Parameters:
byteBuffer -
Throws:
InvalidFrameException

read

public void read(java.nio.ByteBuffer byteBuffer)
          throws InvalidFrameException,
                 InvalidDataTypeException
Read the frame from the specified file. Read the frame header then delegate reading of data to frame body.

Specified by:
read in class AbstractTagItem
Parameters:
byteBuffer - to read the frame from
Throws:
InvalidFrameException
InvalidDataTypeException

write

public void write(java.io.ByteArrayOutputStream tagBuffer)
Write the frame. Writes the frame header but writing the data is delegated to the frame body.

Specified by:
write in class AbstractID3v2Frame
Throws:
java.io.IOException

getStatusFlags

public AbstractID3v2Frame.StatusFlags getStatusFlags()
Get Status Flags Object

Overrides:
getStatusFlags in class AbstractID3v2Frame

getEncodingFlags

public AbstractID3v2Frame.EncodingFlags getEncodingFlags()
Get Encoding Flags Object

Overrides:
getEncodingFlags in class AbstractID3v2Frame

getEncryptionMethod

public int getEncryptionMethod()

getGroupIdentifier

public int getGroupIdentifier()

isValidID3v2FrameIdentifier

public boolean isValidID3v2FrameIdentifier(java.lang.String identifier)
Does the frame identifier meet the syntax for a idv3v2 frame identifier. must start with a capital letter and only contain capital letters and numbers

Parameters:
identifier - to be checked
Returns:
whether the identifier is valid

createStructure

public void createStructure()
Return String Representation of body

Overrides:
createStructure in class AbstractID3v2Frame

isCommon

public boolean isCommon()
Description copied from interface: TagField
Identifies a field to be of common use.

Some software may differ between common and not common fields. A common one is for sure the title field. A web link may not be of common use for tagging. However some file formats, or future development of users expectations will make more fields common than now can be known.

Returns:
true if considered a common frame

isBinary

public boolean isBinary()
Description copied from interface: TagField
Determines whether the represented field contains (is made up of) binary data, instead of text data.
Software can identify fields to be displayed because they are human readable if this method returns false.

Returns:
true if considered a common frame

setEncoding

public void setEncoding(java.lang.String encoding)
Sets the charset encoding used by the field.

Parameters:
encoding - charset.


Copyright © 2005-2010 java.net. All Rights Reserved.