|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--helliker.id3.MP3File
Field Summary | |
static int |
BOTH_TAGS
Write ID3v1 and ID3v2 tags whether or not they exist. |
static int |
EXISTING_TAGS_ONLY
Only write and read tags that already exist. |
static int |
ID3V1_ONLY
Write and read from ID3v1 tags only. |
static int |
ID3V2_ONLY
Write and read from ID3v2 tags only. |
static int |
NO_TAGS
Do not write or read from any id3 tags. |
Constructor Summary | |
MP3File(java.io.File mp3)
Create an MP3File object that reads and writes to the specified file. |
|
MP3File(java.io.File mp3,
int tagType)
Create and MP3File object that reads and writes to the specified file. |
|
MP3File(java.lang.String fn)
Create an MP3File object that reads and writes to the file with the filename fn. |
|
MP3File(java.lang.String fn,
int tagType)
Create an MP3File object that reads and writes to the file with the filename fn. |
Method Summary | |
int |
compareTo(java.lang.Object o)
Compare this MP3File to the specified object. |
boolean |
equals(java.lang.Object o)
Returns true if the object o is equal to this MP3File. |
java.lang.String |
getAlbum()
Returns the album of the mp3 if set and the empty string if not. |
java.lang.String |
getArtist()
Returns the artist of the mp3 if set and the empty string if not. |
int |
getBitRate()
Returns the bitrate of this mp3 in kbps. |
java.lang.String |
getComment()
Returns the comment field of this mp3 if set and the empty string if not. |
java.lang.String |
getComposer()
Returns the composer of this mp3 if set and the empty string if not (id3v2 only). |
java.lang.String |
getCopyrightInfo()
Returns the copyright info of this mp3 if set and the empty string if not (id3v2 only). |
java.lang.String |
getEncodedBy()
Returns who encoded this mp3 if set and the empty string if not (id3v2 only). |
java.lang.String |
getFileName()
Returns the filename of this MP3File. |
long |
getFileSize()
Return the filesize of this MP3File (in bytes). |
byte[] |
getFrameDataBytes(java.lang.String id)
Returns the data contained in the frame specified by the id (id3v2 only) . |
java.lang.String |
getFrameDataString(java.lang.String id)
Returns the textual information contained in the frame specifed by the id. |
java.lang.String |
getGenre()
Returns the genre of this mp3 if set and the empty string if not. |
java.lang.String |
getMPEGChannelMode()
Return the channel mode of the mpeg. |
java.lang.String |
getMPEGEmphasis()
Returns the emphasis of this mp3. |
java.lang.String |
getMPEGLayer()
Returns a string specifying the layer of the mpeg. |
java.lang.String |
getMPEGVersion()
Returns a string specifying the version of the mpeg. |
int |
getNumTracks()
Although not a standard, sometimes track numbers are expressed as "x/y" where x is the track number and y is the total number of tracks on an album. |
java.lang.String |
getOriginalArtist()
Returns the original artist of this mp3 if set and the empty string if not (id3v2 only). |
java.lang.String |
getParent()
Returns the parent directory of this MP3File. |
java.lang.String |
getPath()
Return the absolute path of this MP3File. |
long |
getPlayingTime()
Returns the length (in seconds) of the playing time of this mp3. |
java.lang.String |
getPlayingTimeString()
Return a formatted version of the getPlayingTime method. |
int |
getSampleRate()
Returns the sample rate of this mp3 in Hz. |
int |
getTaggingType()
Returns the currently set tagging type. |
java.lang.String |
getTitle()
Returns the title of this mp3 if set and the empty string if not. |
int |
getTrack()
Returns an integer value of the track number. |
java.lang.String |
getTrackString()
Returns the track exactly as the track field of the id3 tag reads. |
java.lang.String |
getUserDefinedURL()
Returns the user defined url of this mp3 if set and the empty string if not (id3v2 only). |
java.lang.String |
getYear()
Returns the year of this mp3 if set and the empty string if not. |
boolean |
id3v1Exists()
Returns true if an id3v1 tag currently exists. |
boolean |
id3v2Exists()
Returns true if an id3v2 tag currently exists. |
boolean |
isMP3()
Returns true if this file is an mp3. |
boolean |
isMPEGCopyrighted()
Returns true if this mpeg is copyrighted. |
boolean |
isMPEGOriginal()
Returns true if this mpeg is the original. |
boolean |
isMPEGPrivate()
Returns true if the private bit is set in this mpeg. |
boolean |
isMPEGProtected()
Returns true if this mpeg is protected by CRC. |
boolean |
isVBR()
Returns true if this mp3 is a variable bitrate file. |
void |
removeTags(int type)
Removes id3 tags from the file. |
void |
setAlbum(java.lang.String album)
Set the album of this mp3. |
void |
setArtist(java.lang.String artist)
Set the artist of this mp3. |
void |
setComment(java.lang.String comment)
Add a comment to this mp3. |
void |
setComposer(java.lang.String composer)
Set the composer of this mp3 (id3v2 only). |
void |
setCopyrightInfo(java.lang.String copyright)
Add some copyright information to this mp3 (id3v2 only). |
void |
setEncodedBy(java.lang.String encBy)
Set who encoded the mp3 (id3v2 only). |
void |
setFrameData(java.lang.String id,
byte[] data)
Set the data of the frame specified by the id (id3v2 only). |
void |
setGenre(java.lang.String genre)
Set the genre of this mp3. |
void |
setOriginalArtist(java.lang.String artist)
Set the original artist of this mp3 (id3v2 only). |
void |
setTaggingType(int newType)
Set the tagging type. |
void |
setTextFrame(java.lang.String id,
java.lang.String data)
Set the text of the text frame specified by the id (id3v2 only). |
void |
setTitle(java.lang.String title)
Set the title of this mp3. |
void |
setTrack(int track)
Set the track number of this mp3. |
void |
setTrack(java.lang.String track)
Set the track number with a String. |
void |
setUserDefinedText(java.lang.String desc,
java.lang.String text)
Add a field of miscellaneous text (id3v2 only). |
void |
setUserDefinedURL(java.lang.String desc,
java.lang.String url)
Add a link to this mp3 (id3v2 only). |
void |
setYear(java.lang.String year)
Set the year of this mp3. |
java.lang.String |
toString()
Return a string representation of this object. |
void |
writeTags()
Writes the current state of the id3 tags to the file. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int BOTH_TAGS
public static final int ID3V2_ONLY
public static final int ID3V1_ONLY
public static final int NO_TAGS
public static final int EXISTING_TAGS_ONLY
Constructor Detail |
public MP3File(java.lang.String fn) throws java.io.FileNotFoundException, NoMPEGFramesException, java.io.IOException, ID3v2FormatException, CorruptHeaderException
fn
- the filename of the mp3
java.io.FileNotFoundException
- if an error occurs
NoMPEGFramesException
- if an error occurs
java.io.IOException
- if an error occurs
ID3v2FormatException
- if an error occurs
CorruptHeaderException
- if an error occurspublic MP3File(java.io.File mp3) throws java.io.FileNotFoundException, NoMPEGFramesException, java.io.IOException, ID3v2FormatException, CorruptHeaderException
mp3
- the file of the mp3
java.io.FileNotFoundException
- if an error occurs
NoMPEGFramesException
- if an error occurs
java.io.IOException
- if an error occurs
ID3v2FormatException
- if an error occurs
CorruptHeaderException
- if an error occurspublic MP3File(java.lang.String fn, int tagType) throws java.io.FileNotFoundException, NoMPEGFramesException, java.io.IOException, ID3v2FormatException, CorruptHeaderException
fn
- the filename of the mp3tagType
- determines what type of tags to write and read from
java.io.FileNotFoundException
- if an error occurs
NoMPEGFramesException
- if an error occurs
java.io.IOException
- if an error occurs
CorruptHeaderException
- if an error occurs
ID3v2FormatException
- if an error occurspublic MP3File(java.io.File mp3, int tagType) throws java.io.FileNotFoundException, NoMPEGFramesException, java.io.IOException, ID3v2FormatException, CorruptHeaderException
mp3
- the file of the mp3tagType
- determines what type of tags to write and read from
java.io.FileNotFoundException
- if an error occurs
NoMPEGFramesException
- if an error occurs
java.io.IOException
- if an error occurs
ID3v2FormatException
- if an error occurs
CorruptHeaderException
- if an error occursMethod Detail |
public long getPlayingTime()
public java.lang.String getPlayingTimeString()
public java.lang.String getPath()
public java.lang.String getParent()
public java.lang.String getFileName()
public long getFileSize()
public boolean id3v2Exists()
public boolean id3v1Exists()
public boolean isMP3()
public boolean isVBR()
public int getBitRate()
public int getSampleRate()
public java.lang.String getMPEGEmphasis()
public java.lang.String getMPEGLayer()
public java.lang.String getMPEGVersion()
public java.lang.String getMPEGChannelMode()
public boolean isMPEGCopyrighted()
public boolean isMPEGOriginal()
public boolean isMPEGProtected()
public boolean isMPEGPrivate()
public void removeTags(int type) throws java.io.FileNotFoundException, java.io.IOException
type
- specifies what tag(s) to remove
java.io.FileNotFoundException
- if an error occurs
java.io.IOException
- if an error occurspublic void writeTags() throws java.io.FileNotFoundException, java.io.IOException
java.io.FileNotFoundException
- if an error occurs
java.io.IOException
- if an error occurspublic void setTitle(java.lang.String title)
title
- the title of the mp3public void setAlbum(java.lang.String album)
album
- the album of the mp3public void setArtist(java.lang.String artist)
artist
- the artist of the mp3public void setComment(java.lang.String comment)
comment
- a comment to add to the mp3public void setGenre(java.lang.String genre)
genre
- the genre of the mp3public void setYear(java.lang.String year)
year
- of the mp3public void setTrack(int track)
track
- the track number of this mp3public void setTrack(java.lang.String track) throws java.lang.NumberFormatException
track
- the track number of this mp3
java.lang.NumberFormatException
- if the String can't be parsed as an
integerpublic void setComposer(java.lang.String composer)
composer
- the composer of this mp3public void setOriginalArtist(java.lang.String artist)
artist
- the original artist of this mp3public void setCopyrightInfo(java.lang.String copyright)
copyright
- copyright information related to this mp3public void setUserDefinedURL(java.lang.String desc, java.lang.String url)
desc
- a description of the urlurl
- the url itselfpublic void setUserDefinedText(java.lang.String desc, java.lang.String text)
desc
- a description of the texttext
- the text itselfpublic void setEncodedBy(java.lang.String encBy)
encBy
- who encoded the mp3public void setTextFrame(java.lang.String id, java.lang.String data)
id
- the id of the frame to set the data fordata
- the data to setpublic void setFrameData(java.lang.String id, byte[] data)
id
- the id of the frame to set the data fordata
- the data to setpublic java.lang.String getArtist() throws ID3v2FormatException
ID3v2FormatException
- if the data of the field is incorrectpublic java.lang.String getAlbum() throws ID3v2FormatException
ID3v2FormatException
- if the data of the field is incorrectpublic java.lang.String getComment() throws ID3v2FormatException
ID3v2FormatException
- if the data of the field is incorrectpublic java.lang.String getGenre() throws ID3v2FormatException
ID3v2FormatException
- if the data of this field is incorrectpublic java.lang.String getTitle() throws ID3v2FormatException
ID3v2FormatException
- if the data of this field is incorrectpublic java.lang.String getTrackString() throws ID3v2FormatException
ID3v2FormatException
- if the data of this field is incorrectpublic int getTrack() throws ID3v2FormatException
ID3v2FormatException
- if an error occurspublic int getNumTracks() throws ID3v2FormatException
ID3v2FormatException
- if an error occurspublic java.lang.String getYear() throws ID3v2FormatException
ID3v2FormatException
- if the data of this field is incorrectpublic java.lang.String getComposer() throws ID3v2FormatException
ID3v2FormatException
- if the data of this field is incorrectpublic java.lang.String getOriginalArtist() throws ID3v2FormatException
ID3v2FormatException
- if the data of this field is incorrectpublic java.lang.String getCopyrightInfo() throws ID3v2FormatException
ID3v2FormatException
- if the data of this field is incorrectpublic java.lang.String getUserDefinedURL() throws ID3v2FormatException
ID3v2FormatException
- if the data of this field is incorrectpublic java.lang.String getEncodedBy() throws ID3v2FormatException
ID3v2FormatException
- if the data of this field is incorrectpublic java.lang.String getFrameDataString(java.lang.String id) throws ID3v2FormatException
id
- the id of the frame to get data from
ID3v2FormatException
- if the data of the frame is incorrectpublic byte[] getFrameDataBytes(java.lang.String id)
id
- the id of the frame to get data from
public int getTaggingType()
public void setTaggingType(int newType)
newType
- the new tagging typepublic java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the object to compare
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
o
- the object to compare to this one
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |