helliker.id3
Class ID3v2Header

java.lang.Object
  |
  +--helliker.id3.ID3v2Header

public class ID3v2Header
extends java.lang.Object


Constructor Summary
ID3v2Header(java.io.File mp3)
          Create an id3v2header linked to the file passed as a parameter.
 
Method Summary
 byte[] getBytes()
          Return an array of bytes representing the header.
 boolean getExperimental()
          Returns true if the experimental bit of this header is set.
 boolean getExtendedHeader()
          Returns true if this tag has an extended header.
 boolean getFooter()
          Returns true if this tag has a footer.
 int getHeaderSize()
          Returns the size (in bytes) of this header.
 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 header portion of the id3v2 tag according to the size field in the header.
 boolean getUnsynchronisation()
          Returns true if the unsynchronisation bit is set in this header.
 boolean headerExists()
          Returns true if a header exists
 void setExperimental(boolean experiment)
          Set the value of the experimental bit of this header.
 void setExtendedHeader(boolean extend)
          Set the value of the extended header bit of this header.
 void setFooter(boolean foot)
          Sets the value of the footer bit for this header.
 void setTagSize(int size)
          Sets the size of the frames and/or extended header.
 void setUnsynchronisation(boolean unsynch)
          Set the unsynchronisation flag for this header.
 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
 

Constructor Detail

ID3v2Header

public ID3v2Header(java.io.File mp3)
            throws java.io.FileNotFoundException,
                   java.io.IOException
Create an id3v2header linked to the file passed as a parameter. An attempt will be made to read the header from the file. If a header exists, then information in the header will be extracted. If a header doesn't exist, default data will be used.

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

getBytes

public byte[] getBytes()
Return an array of bytes representing the header. This can be used to easily write the header to a file. When this method is called it automatically updates the header to the newest format.

Returns:
a binary representation of this header

headerExists

public boolean headerExists()
Returns true if a header exists

Returns:
true if a header exists

getHeaderSize

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

Returns:
the size of this header

getTagSize

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

Returns:
the size field of the header

setTagSize

public void setTagSize(int size)
Sets the size of the frames and/or extended header. If this function is called, the headerExists 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 header.

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

setUnsynchronisation

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

Parameters:
unsynch - the new value of the unsynchronisation flag

getExtendedHeader

public boolean getExtendedHeader()
Returns true if this tag has an extended header.

Returns:
true if this tag has an extended header

setExtendedHeader

public void setExtendedHeader(boolean extend)
Set the value of the extended header bit of this header.

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

getExperimental

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

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

setExperimental

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

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 header.

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

toString

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

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this object