|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.farng.mp3.AbstractMP3FileItem org.farng.mp3.AbstractMP3Tag org.farng.mp3.id3.AbstractID3 org.farng.mp3.id3.AbstractID3v1 org.farng.mp3.id3.ID3v1
What is ID3 (v1)? |
The audio format MPEG layer I, layer II and layer III (MP3) has no native way of saving information about the contents, except for some simple yes/no parameters like "private", "copyrighted" and "original home" (meaning this is the original file and not a copy). A solution to this problem was introduced with the program "Studio3" by Eric Kemp alias NamkraD in 1996. By adding a small chunk of extra data in the end of the file one could get the MP3 file to carry information about the audio and not just the audio itself. The placement of the tag, as the data was called, was probably chosen as there were little chance that it should disturb decoders. In order to make it easy to detect a fixed size of 128 bytes was chosen. The tag has the following layout (as hinted by the scheme to the right):
If you one sum the the size of all these fields we see that 30+30+30+4+30+1 equals 125 bytes and not 128 bytes. The missing three bytes can be found at the very end of the tag, before the song title. These three bytes are always "TAG" and is the identification that this is indeed a ID3 tag. The easiest way to find a ID3v1/1.1 tag is to look for the word "TAG" 128 bytes from the end of a file. As all artists doesn't have a 30 character name it is said that if there is some bytes left after the information is entered in the field, those bytes should be fille with the binary value 0. You might also think that you cannot write that much in the genre field, being one byte big, but it is more clever than that. The byte value you enter in the genre field corresponds to a value in a predefined list. The list that Eric Kemp created had 80 entries, ranging from 0 to 79. |
Field Summary | |
protected java.lang.String |
album
|
protected java.lang.String |
artist
|
protected java.lang.String |
comment
|
protected byte |
genre
|
protected java.lang.String |
title
|
protected java.lang.String |
year
|
Constructor Summary | |
ID3v1()
Creates a new ID3v1 object. |
|
ID3v1(AbstractMP3Tag mp3tag)
Creates a new ID3v1 object. |
|
ID3v1(ID3v1 copyObject)
Creates a new ID3v1 object. |
|
ID3v1(java.io.RandomAccessFile file)
Creates a new ID3v1 object. |
Method Summary | |
void |
append(AbstractMP3Tag tag)
This method does nothing, but is called by subclasses for completeness |
void |
delete(java.io.RandomAccessFile file)
removes the specific tag the easiest way. |
boolean |
equals(java.lang.Object obj)
Determines whether another object is equal to this tag. |
java.lang.String |
getAlbum()
|
java.lang.String |
getAlbumTitle()
|
java.lang.String |
getArtist()
|
java.lang.String |
getAuthorComposer()
|
java.lang.String |
getComment()
|
byte |
getGenre()
|
ID3v1 |
getID3tag(java.io.RandomAccessFile file)
|
java.lang.String |
getIdentifier()
ID string that usually corresponds to the class name, but can be displayed to the user. |
java.lang.String |
getLeadArtist()
|
int |
getSize()
|
java.lang.String |
getSongComment()
|
java.lang.String |
getSongGenre()
|
java.lang.String |
getSongLyric()
|
java.lang.String |
getSongTitle()
|
java.lang.String |
getTitle()
|
java.lang.String |
getTrackNumberOnAlbum()
|
java.lang.String |
getYear()
|
java.lang.String |
getYearReleased()
|
java.util.Iterator |
iterator()
|
void |
overwrite(AbstractMP3Tag tag)
This method does nothing, but is called by subclasses for completeness |
void |
read(java.io.RandomAccessFile file)
import java.io.IOException; import java.io.RandomAccessFile; read from current file pointer position. |
boolean |
seek(java.io.RandomAccessFile file)
Looks for this tag. |
void |
setAlbum(java.lang.String album)
|
void |
setAlbumTitle(java.lang.String albumTitle)
|
void |
setArtist(java.lang.String artist)
|
void |
setAuthorComposer(java.lang.String authorComposer)
|
void |
setComment(java.lang.String comment)
|
void |
setGenre(byte genre)
|
void |
setLeadArtist(java.lang.String leadArtist)
|
void |
setSongComment(java.lang.String songComment)
|
void |
setSongGenre(java.lang.String songGenre)
|
void |
setSongLyric(java.lang.String songLyrics)
|
void |
setSongTitle(java.lang.String songTitle)
|
void |
setTitle(java.lang.String title)
|
void |
setTrackNumberOnAlbum(java.lang.String trackNumberOnAlbum)
|
void |
setYear(java.lang.String year)
|
void |
setYearReleased(java.lang.String yearReleased)
|
java.lang.String |
toString()
|
void |
write(AbstractMP3Tag tag)
This method does nothing, but is called by subclasses for completeness |
void |
write(java.io.RandomAccessFile file)
Method to write this object to the file argument at is current file pointer position. |
Methods inherited from class org.farng.mp3.id3.AbstractID3v1 |
append, overwrite |
Methods inherited from class org.farng.mp3.AbstractMP3Tag |
isSubsetOf |
Methods inherited from class org.farng.mp3.AbstractMP3FileItem |
isSubsetOf |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.String album
protected java.lang.String artist
protected java.lang.String comment
protected java.lang.String title
protected java.lang.String year
protected byte genre
Constructor Detail |
public ID3v1()
public ID3v1(ID3v1 copyObject)
public ID3v1(AbstractMP3Tag mp3tag)
public ID3v1(java.io.RandomAccessFile file) throws TagNotFoundException, java.io.IOException
Method Detail |
public void setAlbum(java.lang.String album)
public java.lang.String getAlbum()
public void setArtist(java.lang.String artist)
public java.lang.String getArtist()
public void setComment(java.lang.String comment)
public java.lang.String getComment()
public void setGenre(byte genre)
public byte getGenre()
public ID3v1 getID3tag(java.io.RandomAccessFile file) throws java.io.IOException
java.io.IOException
public java.lang.String getIdentifier()
AbstractMP3FileItem
getIdentifier
in class AbstractMP3FileItem
public int getSize()
getSize
in class AbstractMP3FileItem
public void setTitle(java.lang.String title)
public java.lang.String getTitle()
public void setYear(java.lang.String year)
public java.lang.String getYear()
public void append(AbstractMP3Tag tag)
AbstractMP3Tag
append
in class AbstractMP3Tag
tag
- tag to overwritepublic void delete(java.io.RandomAccessFile file) throws java.io.IOException
AbstractMP3Tag
delete
in class AbstractMP3Tag
file
- MP3 file to append to.
java.io.IOException
- on any I/O errorpublic boolean equals(java.lang.Object obj)
AbstractMP3Tag
super.equals(object)
.
equals
in class AbstractMP3Tag
public java.util.Iterator iterator()
iterator
in class AbstractMP3Tag
public void overwrite(AbstractMP3Tag tag)
AbstractMP3Tag
overwrite
in class AbstractMP3Tag
tag
- tag to overwritepublic void read(java.io.RandomAccessFile file) throws TagNotFoundException, java.io.IOException
AbstractMP3FileItem
read
in class AbstractMP3FileItem
file
- file to read from
java.io.IOException
- on any I/O error
TagNotFoundException
public boolean seek(java.io.RandomAccessFile file) throws java.io.IOException
AbstractMP3Tag
seek
in class AbstractMP3Tag
file
- MP3 file to overwrite
java.io.IOException
- on any I/O errorpublic java.lang.String toString()
public void write(AbstractMP3Tag tag)
AbstractMP3Tag
write
in class AbstractMP3Tag
tag
- tag to write topublic void write(java.io.RandomAccessFile file) throws java.io.IOException
AbstractMP3FileItem
write
in class AbstractMP3FileItem
file
- file to write to
java.io.IOException
- on any I/O errorpublic java.lang.String getSongTitle()
getSongTitle
in class AbstractMP3Tag
public java.lang.String getLeadArtist()
getLeadArtist
in class AbstractMP3Tag
public java.lang.String getAlbumTitle()
getAlbumTitle
in class AbstractMP3Tag
public java.lang.String getYearReleased()
getYearReleased
in class AbstractMP3Tag
public java.lang.String getSongComment()
getSongComment
in class AbstractMP3Tag
public java.lang.String getSongGenre()
getSongGenre
in class AbstractMP3Tag
public java.lang.String getTrackNumberOnAlbum()
getTrackNumberOnAlbum
in class AbstractMP3Tag
public java.lang.String getSongLyric()
getSongLyric
in class AbstractMP3Tag
public java.lang.String getAuthorComposer()
getAuthorComposer
in class AbstractMP3Tag
public void setSongTitle(java.lang.String songTitle)
setSongTitle
in class AbstractMP3Tag
public void setLeadArtist(java.lang.String leadArtist)
setLeadArtist
in class AbstractMP3Tag
public void setAlbumTitle(java.lang.String albumTitle)
setAlbumTitle
in class AbstractMP3Tag
public void setYearReleased(java.lang.String yearReleased)
setYearReleased
in class AbstractMP3Tag
public void setSongComment(java.lang.String songComment)
setSongComment
in class AbstractMP3Tag
public void setSongGenre(java.lang.String songGenre)
setSongGenre
in class AbstractMP3Tag
public void setTrackNumberOnAlbum(java.lang.String trackNumberOnAlbum)
setTrackNumberOnAlbum
in class AbstractMP3Tag
public void setSongLyric(java.lang.String songLyrics)
setSongLyric
in class AbstractMP3Tag
public void setAuthorComposer(java.lang.String authorComposer)
setAuthorComposer
in class AbstractMP3Tag
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |