All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class de.vdheide.mp3.ID3v2

java.lang.Object
   |
   +----de.vdheide.mp3.ID3v2

public class ID3v2
extends Object

Variable Index

 o REVISION
ID3v2 revision
 o VERSION
ID3v2 version

Constructor Index

 o ID3v2(File)
Provides access to file's ID3v2 tag
 o ID3v2(InputStream)
Provides access to ID3v2 tag.

Method Index

 o addFrame(ID3v2Frame)
Add a frame
 o getFrame(String)
Return all frame with ID id
 o getFrames()
Get all frames
 o getUseCRC()
 o getUsePadding()
 o getUseUnsynchronization()
 o hasTag()
Test if file already has an ID3v2 tag
 o removeFrame(ID3v2Frame)
Remove a frame.
 o removeFrame(String)
Remove all frames with a given id.
 o removeFrame(String, int)
Remove a spefic frames with a given id.
 o removeFrames()
Remove all frames
 o setUseCRC(boolean)
Enables / disables use of CRC
 o setUsePadding(boolean)
Enables or disables use of padding (enabled by default)
 o setUseUnsynchronization(boolean)
Enables / disables use of unsynchronization
 o synchronize(byte[])
This method undoes the effect of the unsynchronization scheme by replacing $FF $00 by $FF
 o unsynchronize(byte[])
Unsynchronizes an array of bytes by replacing $FF 00 with $FF 00 00 and %11111111 111xxxxx with %11111111 00000000 111xxxxx.
 o update()
Write changes to file

Variables

 o VERSION
 public static final byte VERSION
ID3v2 version

 o REVISION
 public static final byte REVISION
ID3v2 revision

Constructors

 o ID3v2
 public ID3v2(InputStream in) throws IOException, ID3v2IllegalVersionException, ID3v2WrongCRCException, ID3v2DecompressionException
Provides access to ID3v2 tag. When used with an InputStream, no writes are possible (update will fail with an IOException, so make sure you just read.

Parameters:
in - Input stream to read from. Stream position must be set to beginning of file (i.e. position of ID3v2 tag).
Throws: IOException
If I/O errors occur
Throws: ID3v2IllegalVersionException
If file contains an IDv2 tag of higher version than VERSION.REVISION
Throws: ID3v2WrongCRCException
If file contains CRC and this differs from CRC calculated from the frames
Throws: ID3v2DecompressionException
If a decompression error occured while decompressing a compressed frame
 o ID3v2
 public ID3v2(File file) throws IOException, ID3v2IllegalVersionException, ID3v2WrongCRCException, ID3v2DecompressionException
Provides access to file's ID3v2 tag

Parameters:
file - File to access
Throws: IOException
If I/O errors occur
Throws: ID3v2IllegalVersionException
If file contains an IDv2 tag of higher version than VERSION.REVISION
Throws: ID3v2WrongCRCException
If file contains CRC and this differs from CRC calculated from the frames
Throws: ID3v2DecompressionException
If a decompression error occured while decompressing a compressed frame

Methods

 o synchronize
 public static byte[] synchronize(byte in[])
This method undoes the effect of the unsynchronization scheme by replacing $FF $00 by $FF

Parameters:
in - Array of bytes to be "synchronized"
Returns:
Changed array or null if no "synchronization" was necessary
 o unsynchronize
 public static byte[] unsynchronize(byte in[])
Unsynchronizes an array of bytes by replacing $FF 00 with $FF 00 00 and %11111111 111xxxxx with %11111111 00000000 111xxxxx.

Parameters:
in - Array of bytes to be "unsynchronized"
Returns:
Changed array or null if no change was necessary
 o setUsePadding
 public void setUsePadding(boolean use_padding)
Enables or disables use of padding (enabled by default)

Parameters:
use_padding - True if padding should be used
 o getUsePadding
 public boolean getUsePadding()
Returns:
True if padding is used
 o setUseCRC
 public void setUseCRC(boolean use_crc)
Enables / disables use of CRC

Parameters:
use_crc - True if CRC should be used
 o getUseCRC
 public boolean getUseCRC()
Returns:
True if CRC is used
 o setUseUnsynchronization
 public void setUseUnsynchronization(boolean use_unsynch)
Enables / disables use of unsynchronization

Parameters:
use_crc - True if unsynchronization should be used
 o getUseUnsynchronization
 public boolean getUseUnsynchronization()
Returns:
True if unsynchronization should be used
 o hasTag
 public boolean hasTag()
Test if file already has an ID3v2 tag

Returns:
true if file has IDv2 tag
 o getFrames
 public Vector getFrames() throws NoID3v2TagException
Get all frames

Returns:
Vector of all frames
Throws: NoID3v2TagException
If file does not contain ID3v2 tag
 o getFrame
 public Vector getFrame(String id) throws NoID3v2TagException, ID3v2NoSuchFrameException
Return all frame with ID id

Parameters:
id - Frame ID
Returns:
Requested frames
Throws: NoID3v2TagException
If file does not contain ID3v2Tag
Throws: ID3v2NoSuchFrameException
If file does not contain requested ID3v2 frame
 o addFrame
 public void addFrame(ID3v2Frame frame)
Add a frame

Parameters:
frame - Frame to add
 o removeFrame
 public void removeFrame(ID3v2Frame frame) throws NoID3v2TagException, ID3v2NoSuchFrameException
Remove a frame.

Parameters:
frame - Frame to remove
Throws: NoID3v2TagException
If file does not contain ID3v2Tag
Throws: ID3v2NoSuchFrameException
If file does not contain requested ID3v2 frame
 o removeFrame
 public void removeFrame(String id) throws NoID3v2TagException, ID3v2NoSuchFrameException
Remove all frames with a given id.

Parameters:
id - ID of frames to remove
Throws: NoID3v2TagException
If file does not contain ID3v2Tag
Throws: ID3v2NoSuchFrameException
If file does not contain requested ID3v2 frame
 o removeFrame
 public void removeFrame(String id,
                         int number) throws NoID3v2TagException, ID3v2NoSuchFrameException
Remove a spefic frames with a given id. A number is given to identify the frame if more than one frame exists

Parameters:
id - ID of frames to remove
number - Number of frame to remove (the first frame gets number 0)
Throws: NoID3v2TagException
If file does not contain ID3v2Tag
Throws: ID3v2NoSuchFrameException
If file does not contain requested ID3v2 frame
 o removeFrames
 public void removeFrames()
Remove all frames

 o update
 public void update() throws IOException
Write changes to file

Throws: IOException
If an I/O error occurs

All Packages  Class Hierarchy  This Package  Previous  Next  Index