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
-
REVISION
- ID3v2 revision
-
VERSION
- ID3v2 version
-
ID3v2(File)
- Provides access to
file
's ID3v2 tag
-
ID3v2(InputStream)
- Provides access to ID3v2 tag.
-
addFrame(ID3v2Frame)
- Add a frame
-
getFrame(String)
- Return all frame with ID
id
-
getFrames()
- Get all frames
-
getUseCRC()
-
-
getUsePadding()
-
-
getUseUnsynchronization()
-
-
hasTag()
- Test if file already has an ID3v2 tag
-
removeFrame(ID3v2Frame)
- Remove a frame.
-
removeFrame(String)
- Remove all frames with a given id.
-
removeFrame(String, int)
- Remove a spefic frames with a given id.
-
removeFrames()
- Remove all frames
-
setUseCRC(boolean)
- Enables / disables use of CRC
-
setUsePadding(boolean)
- Enables or disables use of padding (enabled by default)
-
setUseUnsynchronization(boolean)
- Enables / disables use of unsynchronization
-
synchronize(byte[])
- This method undoes the effect of the unsynchronization scheme
by replacing $FF $00 by $FF
-
unsynchronize(byte[])
- Unsynchronizes an array of bytes by replacing $FF 00 with
$FF 00 00 and %11111111 111xxxxx with
%11111111 00000000 111xxxxx.
-
update()
- Write changes to file
VERSION
public static final byte VERSION
- ID3v2 version
REVISION
public static final byte REVISION
- ID3v2 revision
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
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
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
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
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
getUsePadding
public boolean getUsePadding()
- Returns:
- True if padding is used
setUseCRC
public void setUseCRC(boolean use_crc)
- Enables / disables use of CRC
- Parameters:
- use_crc - True if CRC should be used
getUseCRC
public boolean getUseCRC()
- Returns:
- True if CRC is used
setUseUnsynchronization
public void setUseUnsynchronization(boolean use_unsynch)
- Enables / disables use of unsynchronization
- Parameters:
- use_crc - True if unsynchronization should be used
getUseUnsynchronization
public boolean getUseUnsynchronization()
- Returns:
- True if unsynchronization should be used
hasTag
public boolean hasTag()
- Test if file already has an ID3v2 tag
- Returns:
- true if file has IDv2 tag
getFrames
public Vector getFrames() throws NoID3v2TagException
- Get all frames
- Returns:
-
Vector
of all frames
- Throws: NoID3v2TagException
- If file does not contain ID3v2 tag
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
addFrame
public void addFrame(ID3v2Frame frame)
- Add a frame
- Parameters:
- frame - Frame to add
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
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
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
removeFrames
public void removeFrames()
- Remove all frames
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