helliker.id3
Class ID3v2Footer

java.lang.Object
  extended byhelliker.id3.ID3v2Footer

public class ID3v2Footer
extends java.lang.Object


Field Summary
private  java.lang.String ENC_TYPE
           
private  boolean experimental
           
private  boolean extended
           
private  int FOOT_SIZE
           
private  boolean footer
           
private  boolean footerExists
           
private  int majorVersion
           
private  int minorVersion
           
private  java.io.File mp3
           
private  int NEW_MAJOR_VERSION
           
private  int NEW_MINOR_VERSION
           
private  java.lang.String TAG_START
           
private  int tagSize
           
private  boolean unsynchronisation
           
 
Constructor Summary
ID3v2Footer(java.io.File mp3, int location)
          Creates and id3v2 footer.
 
Method Summary
private  boolean checkFooter(java.io.RandomAccessFile raf, int location)
          Checks to see if there is an id3v2 footer in the file provided to the constructor.
 boolean footerExists()
          Returns true if a footer exists
 byte[] getBytes()
          Return an array of bytes representing the footer.
 boolean getExperimental()
          Returns true if the experimental bit of this footer is set.
 boolean getExtendedFooter()
          Returns true if this tag has an extended footer.
private  byte getFlagByte()
          A helper function for the getBytes function that returns a byte with the proper flags set.
 boolean getFooter()
          Returns true if this tag has a footer.
 int getFooterSize()
          Returns the size (in bytes) of this footer.
 int getMajorVersion()
          Returns the major version of this id3v2 tag.
 int getMinorVersion()
          Return the minor version/revision of this id3v2 tag.
 int getTagSize()
          Returns the size (in bytes) of the frames and/or extended footer portion of the id3v2 tag according to the size field in the footer.
 boolean getUnsynchronisation()
          Returns true if the unsynchronisation bit is set in this footer.
private  void readFooter(java.io.RandomAccessFile raf, int location)
          Extracts the information from the footer.
 void setExperimental(boolean experiment)
          Set the value of the experimental bit of this footer.
 void setExtendedFooter(boolean extend)
          Set the value of the extended footer bit of this footer.
 void setFooter(boolean foot)
          Sets the value of the footer bit for this footer.
 void setTagSize(int size)
          Sets the size of the frames and/or extended footer.
 void setUnsynchronisation(boolean unsynch)
          Set the unsynchronisation flag for this footer.
 java.lang.String toString()
          Return a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TAG_START

private final java.lang.String TAG_START
See Also:
Constant Field Values

ENC_TYPE

private final java.lang.String ENC_TYPE
See Also:
Constant Field Values

FOOT_SIZE

private final int FOOT_SIZE
See Also:
Constant Field Values

NEW_MAJOR_VERSION

private final int NEW_MAJOR_VERSION
See Also:
Constant Field Values

NEW_MINOR_VERSION

private final int NEW_MINOR_VERSION
See Also:
Constant Field Values

mp3

private java.io.File mp3

footerExists

private boolean footerExists

majorVersion

private int majorVersion

minorVersion

private int minorVersion

unsynchronisation

private boolean unsynchronisation

extended

private boolean extended

experimental

private boolean experimental

footer

private boolean footer

tagSize

private int tagSize
Constructor Detail

ID3v2Footer

public ID3v2Footer(java.io.File mp3,
                   int location)
            throws java.io.FileNotFoundException,
                   java.io.IOException
Creates and id3v2 footer. This is almost identical to an id3v2 header but is placed at the end of the tag and is optional. It should only be used when tags are appended. An attempt will be made to read from the file provided from the location provided.

Parameters:
mp3 - the file to read from
location - the location to find the footer
Throws:
java.io.FileNotFoundException - if an error occurs
java.io.IOException - if an error occurs
Method Detail

checkFooter

private boolean checkFooter(java.io.RandomAccessFile raf,
                            int location)
                     throws java.io.FileNotFoundException,
                            java.io.IOException
Checks to see if there is an id3v2 footer in the file provided to the constructor.

Parameters:
raf - the open file to read from
location - where the footer should be located in the file
Returns:
true if an id3v2 footer exists in the file
Throws:
java.io.FileNotFoundException - if an error occurs
java.io.IOException - if an error occurs

readFooter

private void readFooter(java.io.RandomAccessFile raf,
                        int location)
                 throws java.io.FileNotFoundException,
                        java.io.IOException
Extracts the information from the footer.

Parameters:
raf - the open file to read from
location - where the footer is in the file
Throws:
java.io.FileNotFoundException - if an error occurs
java.io.IOException - if an error occurs

getBytes

public byte[] getBytes()
Return an array of bytes representing the footer. This can be used to easily write the footer to a file.

Returns:
a binary representation of this footer

getFlagByte

private byte getFlagByte()
A helper function for the getBytes function that returns a byte with the proper flags set.

Returns:
the flags byte of this footer

footerExists

public boolean footerExists()
Returns true if a footer exists

Returns:
true if a footer exists

getFooterSize

public int getFooterSize()
Returns the size (in bytes) of this footer. This is always 10.

Returns:
the size of this footer

getTagSize

public int getTagSize()
Returns the size (in bytes) of the frames and/or extended footer portion of the id3v2 tag according to the size field in the footer.

Returns:
the size field of the footer

setTagSize

public void setTagSize(int size)
Sets the size of the frames and/or extended footer. If this function is called, the footerExists function will return true. This is called every time a frame is updated, added, or removed.

Parameters:
size - a value of type 'int'

getMajorVersion

public int getMajorVersion()
Returns the major version of this id3v2 tag.

Returns:
the major version of this id3v2 tag.

getMinorVersion

public int getMinorVersion()
Return the minor version/revision of this id3v2 tag.

Returns:
the minor version/revision of this id3v2 tag.

getUnsynchronisation

public boolean getUnsynchronisation()
Returns true if the unsynchronisation bit is set in this footer.

Returns:
true if the unsynchronisation bit is set in this footer.

setUnsynchronisation

public void setUnsynchronisation(boolean unsynch)
Set the unsynchronisation flag for this footer.

Parameters:
unsynch - the new value of the unsynchronisation flag

getExtendedFooter

public boolean getExtendedFooter()
Returns true if this tag has an extended footer.

Returns:
true if this tag has an extended footer

setExtendedFooter

public void setExtendedFooter(boolean extend)
Set the value of the extended footer bit of this footer.

Parameters:
extend - the new value of the extended footer bit

getExperimental

public boolean getExperimental()
Returns true if the experimental bit of this footer is set.

Returns:
true if the experimental bit of this footer is set

setExperimental

public void setExperimental(boolean experiment)
Set the value of the experimental bit of this footer.

Parameters:
experiment - the new value of the experimental bit

getFooter

public boolean getFooter()
Returns true if this tag has a footer.

Returns:
true if this tag has a footer

setFooter

public void setFooter(boolean foot)
Sets the value of the footer bit for this footer.

Parameters:
foot - the new value of the footer bit for this footer

toString

public java.lang.String toString()
Return a string representation of this object. Contains all information contained within.

Returns:
a string representation of this object


Copyright © 2004 NeurosDBM Dev Team All Rights Reserved.