|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.farng.mp3.AbstractMP3FileItem
org.farng.mp3.AbstractMP3Tag
org.farng.mp3.id3.AbstractID3
org.farng.mp3.id3.AbstractID3v1
org.farng.mp3.id3.ID3v1
public class 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()
Get the song's album title. |
java.lang.String |
getArtist()
|
java.lang.String |
getAuthorComposer()
Get the author/composer. |
java.lang.String |
getComment()
|
byte |
getGenre()
|
ID3v1 |
getID3tag(java.io.RandomAccessFile file)
|
java.lang.String |
getIdentifier()
|
java.lang.String |
getLeadArtist()
Get the lead artist. |
int |
getSize()
|
java.lang.String |
getSongComment()
Get a song comment. |
java.lang.String |
getSongGenre()
Get the genre. |
java.lang.String |
getSongLyric()
Get the song lyrics. |
java.lang.String |
getSongTitle()
Get the song title. |
java.lang.String |
getTitle()
|
java.lang.String |
getTrackNumberOnAlbum()
Get the track number. |
java.lang.String |
getYear()
|
java.lang.String |
getYearReleased()
Get the year the song was released. |
java.util.Iterator |
iterator()
Get an iterator over all tags available. |
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
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.IOExceptionpublic java.lang.String getIdentifier()
getIdentifier in class AbstractMP3FileItempublic int getSize()
getSize in class AbstractMP3FileItempublic 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 AbstractMP3Tagtag - tag to overwrite
public void delete(java.io.RandomAccessFile file)
throws java.io.IOException
AbstractMP3Tag
delete in class AbstractMP3Tagfile - MP3 file to append to.
java.io.IOException - on any I/O errorpublic boolean equals(java.lang.Object obj)
AbstractMP3Tagsuper.equals(object).
equals in class AbstractMP3Tagobj - object to determine equality of
public java.util.Iterator iterator()
MP3Tag
public void overwrite(AbstractMP3Tag tag)
AbstractMP3Tag
overwrite in class AbstractMP3Tagtag - tag to overwrite
public void read(java.io.RandomAccessFile file)
throws TagNotFoundException,
java.io.IOException
AbstractMP3FileItem
read in class AbstractMP3FileItemfile - 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 AbstractMP3Tagfile - MP3 file to overwrite
java.io.IOException - on any I/O errorpublic java.lang.String toString()
toString in class java.lang.Objectpublic void write(AbstractMP3Tag tag)
AbstractMP3Tag
write in class AbstractMP3Tagtag - tag to write to
public void write(java.io.RandomAccessFile file)
throws java.io.IOException
AbstractMP3FileItem
write in class AbstractMP3FileItemfile - file to write to
java.io.IOException - on any I/O errorpublic java.lang.String getSongTitle()
MP3Tag
public java.lang.String getLeadArtist()
MP3Tag
public java.lang.String getAlbumTitle()
MP3Tag
public java.lang.String getYearReleased()
MP3Tag
public java.lang.String getSongComment()
MP3Tag
public java.lang.String getSongGenre()
MP3Tag
public java.lang.String getTrackNumberOnAlbum()
MP3Tag
public java.lang.String getSongLyric()
MP3Tag
public java.lang.String getAuthorComposer()
MP3Tag
public void setSongTitle(java.lang.String songTitle)
setSongTitle in class AbstractMP3Tagpublic void setLeadArtist(java.lang.String leadArtist)
setLeadArtist in class AbstractMP3Tagpublic void setAlbumTitle(java.lang.String albumTitle)
setAlbumTitle in class AbstractMP3Tagpublic void setYearReleased(java.lang.String yearReleased)
setYearReleased in class AbstractMP3Tagpublic void setSongComment(java.lang.String songComment)
setSongComment in class AbstractMP3Tagpublic void setSongGenre(java.lang.String songGenre)
setSongGenre in class AbstractMP3Tagpublic void setTrackNumberOnAlbum(java.lang.String trackNumberOnAlbum)
setTrackNumberOnAlbum in class AbstractMP3Tagpublic void setSongLyric(java.lang.String songLyrics)
setSongLyric in class AbstractMP3Tagpublic 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 | |||||||||