org.metasyntactic.id3.v1
Class Tag

java.lang.Object
  |
  +--org.metasyntactic.id3.v1.Tag

public class Tag
extends java.lang.Object

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):

This class supports making tags, weading and writing them to streams, and adding them and removing them from files


Constructor Summary
Tag()
          Creates a default (empty) tag
Tag(java.lang.String title, java.lang.String artist, java.lang.String album, int year, java.lang.String comment, byte track, byte genre)
          Creates new Tag
 
Method Summary
 boolean equals(java.lang.Object o)
           
 boolean equals(Tag t)
           
 java.lang.String getAlbum()
           
 java.lang.String getArtist()
           
 java.lang.String getComment()
           
 byte getGenre()
           
 java.lang.String getTitle()
           
 int getTrack()
           
 int getYear()
           
 int hashCode()
           
static void main(java.lang.String[] args)
           
static Tag read(java.io.InputStream in)
          Tries to read an ID3 Tag starting at the current pointer of the input stream.
 void setAlbum(java.lang.String str)
           
 void setArtist(java.lang.String str)
           
 void setComment(java.lang.String str)
           
 void setGenre(byte genre)
           
 void setTitle(java.lang.String str)
           
 void setTrack(byte track)
           
 void setYear(int year)
           
 java.lang.String toString()
           
 void write(java.io.OutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Tag

public Tag(java.lang.String title,
           java.lang.String artist,
           java.lang.String album,
           int year,
           java.lang.String comment,
           byte track,
           byte genre)
Creates new Tag


Tag

public Tag()
Creates a default (empty) tag

Method Detail

getTitle

public java.lang.String getTitle()

getArtist

public java.lang.String getArtist()

getAlbum

public java.lang.String getAlbum()

getComment

public java.lang.String getComment()

getTrack

public int getTrack()

getYear

public int getYear()

getGenre

public byte getGenre()

setTitle

public void setTitle(java.lang.String str)

setArtist

public void setArtist(java.lang.String str)

setAlbum

public void setAlbum(java.lang.String str)

setYear

public void setYear(int year)

setComment

public void setComment(java.lang.String str)

setGenre

public void setGenre(byte genre)

setTrack

public void setTrack(byte track)

write

public void write(java.io.OutputStream out)
           throws java.io.IOException
java.io.IOException

read

public static Tag read(java.io.InputStream in)
                throws java.io.IOException
Tries to read an ID3 Tag starting at the current pointer of the input stream. If no tag can be read null is returned

java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

equals

public boolean equals(Tag t)

main

public static void main(java.lang.String[] args)