helliker.id3
Class ID3v2ExtendedHeader

java.lang.Object
  extended byhelliker.id3.ID3v2ExtendedHeader

public class ID3v2ExtendedHeader
extends java.lang.Object


Field Summary
private  byte[] crc
           
private  int CRC_SIZE
           
private  boolean crced
           
private  int EXT_HEAD_LOCATION
           
private  boolean imageEncode
           
private  int imageRestrict
           
private  int[] MAX_TAG_FRAMES_TABLE
           
private  int[] MAX_TAG_SIZE_TABLE
           
private  int[] MAX_TEXT_SIZE_TABLE
           
private  int maxFrames
           
private  int maxTagSize
           
private  int maxTextSize
           
private  int MIN_SIZE
           
private  java.io.File mp3
           
private  int numFlagBytes
           
private  int size
           
private  boolean textEncode
           
private  boolean update
           
 
Constructor Summary
ID3v2ExtendedHeader(java.io.File mp3)
          Create an extended header object from the file passed.
 
Method Summary
 byte[] getBytes()
          Return an array of bytes representing this extended header in the standard format to be written to a file.
 byte[] getCRC()
          If there is crc data in the extended header, then the attached 5 byte crc will be returned.
 boolean getCRCed()
          Returns true if CRC information is provided for this tag
private  byte[] getFlagBytes()
          A helper function for the getBytes method that returns a byte array representing the extended flags field of the extended header.
 boolean getImageEncode()
          Returns true if the image encode flag is set
 int getImageRestriction()
          Returns the value of the image restriction field or -1 if not set
 int getMaxFrames()
          Returns the maximum number of frames if set.
 int getMaxTagSize()
          Returns the maximum tag size or -1 if unset
 int getMaxTextSize()
          Returns the maximum length of a string if set or -1
 int getNumFlagBytes()
          Returns the number of extended flag bytes
 int getSize()
          Returns the size of the extended header
 boolean getTextEncode()
          Returns true if the text encode flag is set
 boolean getUpdate()
          Returns true if this tag is an update of a previous tag
private  void parseFlags(byte[] flags)
          Parse the extended header flag bytes
private  void readExtendedHeader(java.io.RandomAccessFile raf)
          Read the information in the file's extended header
 java.lang.String toString()
          Returns a string representation of this object that contains all information within.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EXT_HEAD_LOCATION

private final int EXT_HEAD_LOCATION
See Also:
Constant Field Values

MIN_SIZE

private final int MIN_SIZE
See Also:
Constant Field Values

CRC_SIZE

private final int CRC_SIZE
See Also:
Constant Field Values

MAX_TAG_FRAMES_TABLE

private final int[] MAX_TAG_FRAMES_TABLE

MAX_TAG_SIZE_TABLE

private final int[] MAX_TAG_SIZE_TABLE

MAX_TEXT_SIZE_TABLE

private final int[] MAX_TEXT_SIZE_TABLE

mp3

private java.io.File mp3

size

private int size

numFlagBytes

private int numFlagBytes

update

private boolean update

crced

private boolean crced

crc

private byte[] crc

maxFrames

private int maxFrames

maxTagSize

private int maxTagSize

textEncode

private boolean textEncode

maxTextSize

private int maxTextSize

imageEncode

private boolean imageEncode

imageRestrict

private int imageRestrict
Constructor Detail

ID3v2ExtendedHeader

public ID3v2ExtendedHeader(java.io.File mp3)
                    throws java.io.FileNotFoundException,
                           java.io.IOException,
                           ID3v2FormatException
Create an extended header object from the file passed. Information in the file's extended header will be read and stored.

Parameters:
mp3 - the file to read/write to
Throws:
java.io.FileNotFoundException - if an error occurs
java.io.IOException - if an error occurs
ID3v2FormatException - if an error occurs
Method Detail

readExtendedHeader

private void readExtendedHeader(java.io.RandomAccessFile raf)
                         throws java.io.FileNotFoundException,
                                java.io.IOException,
                                ID3v2FormatException
Read the information in the file's extended header

Parameters:
raf - the open file to read from
Throws:
java.io.FileNotFoundException - if an error occurs
java.io.IOException - if an error occurs
ID3v2FormatException - if an error occurs

parseFlags

private void parseFlags(byte[] flags)
                 throws ID3v2FormatException
Parse the extended header flag bytes

Parameters:
flags - the array of extended flags
Throws:
ID3v2FormatException - if an error occurs

getBytes

public byte[] getBytes()
Return an array of bytes representing this extended header in the standard format to be written to a file.

Returns:
a binary represenation of this extended header

getFlagBytes

private byte[] getFlagBytes()
A helper function for the getBytes method that returns a byte array representing the extended flags field of the extended header.

Returns:
the extended flags field of the extended header

getSize

public int getSize()
Returns the size of the extended header

Returns:
the size of the extended header

getNumFlagBytes

public int getNumFlagBytes()
Returns the number of extended flag bytes

Returns:
the number of extended flag bytes

getMaxFrames

public int getMaxFrames()
Returns the maximum number of frames if set. If unset, returns -1

Returns:
the maximum number of frames or -1 if unset

getMaxTagSize

public int getMaxTagSize()
Returns the maximum tag size or -1 if unset

Returns:
the maximum tag size or -1 if unset

getTextEncode

public boolean getTextEncode()
Returns true if the text encode flag is set

Returns:
true if the text encode flag is set

getMaxTextSize

public int getMaxTextSize()
Returns the maximum length of a string if set or -1

Returns:
the maximum length of a string if set or -1

getImageEncode

public boolean getImageEncode()
Returns true if the image encode flag is set

Returns:
true if the image encode flag is set

getImageRestriction

public int getImageRestriction()
Returns the value of the image restriction field or -1 if not set

Returns:
the value of the image restriction field or -1 if not set

getUpdate

public boolean getUpdate()
Returns true if this tag is an update of a previous tag

Returns:
true if this tag is an update of a previous tag

getCRCed

public boolean getCRCed()
Returns true if CRC information is provided for this tag

Returns:
true if CRC information is provided for this tag

getCRC

public byte[] getCRC()
If there is crc data in the extended header, then the attached 5 byte crc will be returned. An empty array will be returned if this has not been set.

Returns:
the attached crc data if there is any

toString

public java.lang.String toString()
Returns a string representation of this object that contains all information within.

Returns:
a string representation of this object


Copyright © 2004 NeurosDBM Dev Team All Rights Reserved.