|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthelliker.id3.ID3v1Tag
Field Summary | |
private java.lang.String |
album
|
private int |
ALBUM_SIZE
|
private java.lang.String |
artist
|
private int |
ARTIST_SIZE
|
private java.lang.String |
comment
|
private int |
COMMENT_SIZE
|
private int |
genre
|
private int |
GENRE_LOCATION
|
private boolean |
headerExists
|
private int |
MAX_GENRE
|
private int |
MAX_TRACK
|
private java.io.File |
mp3
|
private int |
TAG_SIZE
|
private java.lang.String |
TAG_START
|
private java.lang.String |
title
|
private int |
TITLE_SIZE
|
private int |
track
|
private int |
TRACK_LOCATION
|
private java.lang.String |
year
|
private int |
YEAR_SIZE
|
Constructor Summary | |
ID3v1Tag(java.io.File mp3)
Create an id3v1tag from the file specified. |
Method Summary | |
private boolean |
checkHeader(java.io.RandomAccessFile raf)
Checks whether a header for the id3 tag exists yet |
private java.lang.String |
chopSubstring(java.lang.String s,
int start,
int end)
Finds the substring of the String parameter but ends the string with the first null byte encountered. |
void |
copyFrom(ID3Tag tag)
Copies information from the ID3Tag parameter and inserts it into this tag. |
java.lang.String |
getAlbum()
Return the album field of the tag |
java.lang.String |
getArtist()
Return the artist field of the tag |
byte[] |
getBytes()
Returns a binary representation of this id3v1 tag. |
java.lang.String |
getComment()
Return the comment field of the tag |
private byte[] |
getFieldBytes(java.lang.String str,
int length)
Converts a string to an array of bytes with the length specified |
int |
getGenre()
Return the genre field of the tag |
java.lang.String |
getGenreString()
Return the genre name based on the ID3/Nullsoft standards. |
int |
getSize()
Return the size in bytes of the tag. |
java.lang.String |
getTitle()
Return the title field of the tag |
int |
getTrack()
Return the track field of the tag |
java.lang.String |
getYear()
Return the year field of the tag |
private void |
readTag(java.io.RandomAccessFile raf)
Reads the data from the id3v1 tag |
void |
removeTag()
Removes the id3v1 tag from the file specified in the constructor |
void |
setAlbum(java.lang.String newAlbum)
Set the album field of the tag. |
void |
setArtist(java.lang.String newArtist)
Set the artist field of the tag. |
void |
setComment(java.lang.String newComment)
Set the comment field of the tag. |
void |
setGenre(int newGenre)
Set the genre field of the tag. |
boolean |
setGenreString(java.lang.String str)
Attempt to set the genre value of this tag from the string specified. |
void |
setTitle(java.lang.String newTitle)
Set the title field of the tag. |
void |
setTrack(int newTrack)
Set the track field of the tag. |
void |
setYear(java.lang.String newYear)
Set the year field of the tag. |
boolean |
tagExists()
Checks if a tag exists |
java.lang.String |
toString()
Returns a String representation of this object. |
void |
writeTag()
Writes the information in this tag to the file specified in the constructor. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private final int TAG_SIZE
private final int TITLE_SIZE
private final int ARTIST_SIZE
private final int ALBUM_SIZE
private final int YEAR_SIZE
private final int COMMENT_SIZE
private final int TRACK_LOCATION
private final int GENRE_LOCATION
private final int MAX_GENRE
private final int MAX_TRACK
private final java.lang.String TAG_START
private java.io.File mp3
private boolean headerExists
private java.lang.String title
private java.lang.String artist
private java.lang.String album
private java.lang.String year
private java.lang.String comment
private int genre
private int track
Constructor Detail |
public ID3v1Tag(java.io.File mp3) throws java.io.FileNotFoundException, java.io.IOException
mp3
- the file to read/write the tag to
java.io.FileNotFoundException
- if an error occurs
java.io.IOException
- if an error occursMethod Detail |
private boolean checkHeader(java.io.RandomAccessFile raf) throws java.io.FileNotFoundException, java.io.IOException
raf
- the open file to read from
java.io.FileNotFoundException
- if an error occurs
java.io.IOException
- if an error occursprivate void readTag(java.io.RandomAccessFile raf) throws java.io.FileNotFoundException, java.io.IOException
raf
- the open file to read from
java.io.FileNotFoundException
- if an error occurs
java.io.IOException
- if an error occursprivate java.lang.String chopSubstring(java.lang.String s, int start, int end)
s
- the string chopstart
- where to start the stringend
- where to end the string if a null byte isn't found
public void writeTag() throws java.io.FileNotFoundException, java.io.IOException
writeTag
in interface ID3Tag
java.io.FileNotFoundException
- if an error occurs
java.io.IOException
- if an error occurspublic byte[] getBytes()
getBytes
in interface ID3Tag
private byte[] getFieldBytes(java.lang.String str, int length) throws java.io.UnsupportedEncodingException
str
- the string to convertlength
- the size of the byte array
java.io.UnsupportedEncodingException
public void removeTag() throws java.io.FileNotFoundException, java.io.IOException
removeTag
in interface ID3Tag
java.io.FileNotFoundException
- if an error occurs
java.io.IOException
- if an error occurspublic java.lang.String getGenreString()
public boolean setGenreString(java.lang.String str)
str
- the string value of the genre to attempt to set
public boolean tagExists()
public java.lang.String getTitle()
public void setTitle(java.lang.String newTitle)
newTitle
- the title for the tagpublic java.lang.String getArtist()
public void setArtist(java.lang.String newArtist)
newArtist
- the artist for the tagpublic java.lang.String getAlbum()
public void setAlbum(java.lang.String newAlbum)
newAlbum
- the album for the tagpublic java.lang.String getYear()
public void setYear(java.lang.String newYear)
newYear
- the year for the tagpublic java.lang.String getComment()
public void setComment(java.lang.String newComment)
newComment
- the comment of the tagpublic int getTrack()
public void setTrack(int newTrack)
newTrack
- the track of the tagpublic int getGenre()
public void setGenre(int newGenre) throws ID3FieldDataException
newGenre
- the genre of the tag
ID3FieldDataException
- if the value supplie is invalidpublic int getSize()
public java.lang.String toString()
public void copyFrom(ID3Tag tag)
copyFrom
in interface ID3Tag
tag
- the tag to copy from
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |