|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpgbennett.id3.ID3v2Tag
public class ID3v2Tag
Description: This class reads and writes id3v2 tags from a file.
| Constructor Summary | |
|---|---|
ID3v2Tag(java.io.File mp3,
long mpegOffset)
Create an id3v2 tag bound to the file provided as a parameter. |
|
ID3v2Tag(java.io.File mp3,
long mpegOffset,
boolean emptyTag)
|
|
| Method Summary | |
|---|---|
void |
copyFrom(ID3Tag tag)
Copies information from the ID3Tag parameter and inserts it into this tag. |
byte[] |
getBytes()
Return a binary representation of this object to be written to a file. |
byte[] |
getFrameData(java.lang.String id)
Returns the data found in the frame specified by the id. |
java.lang.String |
getFrameDataString(java.lang.String id)
Returns the textual information contained in the frame specified by the id. |
ID3v2Frames |
getFrames()
Get a collection of all frames in the tag. |
ID3v2Header |
getHead()
|
int |
getPadding()
Returns the current number of padding bytes in this id3v2 tag. |
int |
getSize()
Returns the size of this id3v2 tag. |
int |
getTotalSize()
Returns the actual size of the tag when written. |
void |
removeFrame(java.lang.String id)
Remove the frame with the specified id from the file. |
void |
removeTag()
Remove an existing id3v2 tag from the file passed to the constructor. |
void |
setCommentFrame(java.lang.String description,
java.lang.String comment)
Set the data contained in the comments frame (COMM). |
void |
setGenericFrame(java.lang.String id,
byte[] data)
Set the data contained in any frame. |
void |
setGenericFrame(java.lang.String id,
java.lang.String data)
Set the data contained in any frame. |
void |
setGenericFrame(java.lang.String id,
java.lang.String lang,
java.lang.String desc,
java.lang.String data)
|
void |
setPictureFrame(ID3v2Picture pic)
|
void |
setTextFrame(java.lang.String id,
java.lang.String data)
Set the data contained in a text frame. |
void |
setURLFrame(java.lang.String id,
java.lang.String data)
Set the data contained in a URL frame. |
void |
setUserDefinedTextFrame(java.lang.String description,
java.lang.String value)
Sets the data contained in the user defined text frame (TXXX). |
void |
setUserDefinedURLFrame(java.lang.String description,
java.lang.String value)
Sets the data contained in the user defined url frame (WXXX). |
boolean |
tagExists()
Returns true if an id3v2 tag exists in the file that was passed to the constructor and false otherwise |
java.lang.String |
toString()
Return a string representation of this object. |
void |
updateFrameData(java.lang.String id,
byte[] data)
Updates the data for the frame specified by id. |
void |
writeTag()
Saves all the information in the tag to the file passed to the constructor. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ID3v2Tag(java.io.File mp3,
long mpegOffset)
throws java.io.FileNotFoundException,
java.io.IOException,
ID3v2FormatException
mp3 - the file to write/read the the tag
information to/frommpegOffset - the byte offset where the mpeg frames
begin
java.io.FileNotFoundException - if an error occurs
java.io.IOException - if an error occurs
ID3v2FormatException - if an exisiting id3v2 tag isn't correct
public ID3v2Tag(java.io.File mp3,
long mpegOffset,
boolean emptyTag)
throws java.io.FileNotFoundException,
java.io.IOException,
ID3v2FormatException
java.io.FileNotFoundException
java.io.IOException
ID3v2FormatException| Method Detail |
|---|
public void writeTag()
throws java.io.FileNotFoundException,
java.io.IOException
writeTag in interface ID3Tagjava.io.FileNotFoundException - if an error occurs
java.io.IOException - if an error occurs
public void removeTag()
throws java.io.FileNotFoundException,
java.io.IOException
removeTag in interface ID3Tagjava.io.FileNotFoundException - if an error occurs
java.io.IOException - if an error occurspublic byte[] getBytes()
getBytes in interface ID3Tag
public void setTextFrame(java.lang.String id,
java.lang.String data)
id - the id of the frame to set the data fordata - the data for the frame
public void setURLFrame(java.lang.String id,
java.lang.String data)
id - the id of the frame to set the data fordata - the data for the frame
public void setUserDefinedTextFrame(java.lang.String description,
java.lang.String value)
description - a description of the datavalue - the data for the frame
public void setUserDefinedURLFrame(java.lang.String description,
java.lang.String value)
description - a description of the urlvalue - the url for the frame
public void setCommentFrame(java.lang.String description,
java.lang.String comment)
description - a description of the commentcomment - the comment
public void setGenericFrame(java.lang.String id,
java.lang.String data)
id - the id of the frame to set the data fordata - the data for the frame
public void setGenericFrame(java.lang.String id,
java.lang.String lang,
java.lang.String desc,
java.lang.String data)
public void setPictureFrame(ID3v2Picture pic)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public void setGenericFrame(java.lang.String id,
byte[] data)
throws java.io.UnsupportedEncodingException
id - the id of the frame to set the data fordata - the data for the frame
java.io.UnsupportedEncodingExceptionpublic void removeFrame(java.lang.String id)
id - the id of the frame to remove. Extended id in the
case of frames that support it.
public void updateFrameData(java.lang.String id,
byte[] data)
throws java.io.UnsupportedEncodingException
id - the id of the frame to updatedata - the data for the frame
java.io.UnsupportedEncodingException
public java.lang.String getFrameDataString(java.lang.String id)
throws ID3v2FormatException
id - the id of the frame to get text from
or extended id.
ID3v2FormatException - if an error is encountered parsing datapublic byte[] getFrameData(java.lang.String id)
id - the id of the frame to get the data from
or extended id.
public boolean tagExists()
public int getSize()
public int getTotalSize()
public int getPadding()
public java.lang.String toString()
toString in class java.lang.Objectpublic ID3v2Frames getFrames()
public ID3v2Header getHead()
public void copyFrom(ID3Tag tag)
copyFrom in interface ID3Tagtag - the tag to copy from
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||