com.tffenterprises.music.tag
Class SmartID3v1

java.lang.Object
  extended by com.tffenterprises.music.tag.ID3v1
      extended by com.tffenterprises.music.tag.SmartID3v1
All Implemented Interfaces:
ID3Tag, java.io.Serializable, java.lang.Cloneable

public class SmartID3v1
extends ID3v1
implements ID3Tag, java.io.Serializable

SmartID3v1 is an implementation of the so-called ID3v1.1 standard. An object can be constructed from a 125-byte array, from another implementor of the Tag interface or from scratch. If the construction of the object necessitated any string cleaning and/or data sanitization, the isChanged() method will return true on the fresh object (otherwise it will return false, until a later change is made). SmartID3v1 is different from ID3v1 in that it allows only the value -1 as as the genre byte, that is the genre "None". Any other value of the genre byte is effectively prohibited.

Version:
1.0d1 $Date: 2002/10/11 00:57:29 $
Author:
Guillaume Lessard
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.tffenterprises.music.tag.ID3v1
ENCODING, GENRE_NONE, PREFIX, TAG_LENGTH
 
Constructor Summary
SmartID3v1()
          Default constructor.
SmartID3v1(byte[] byteArray)
          Constructor from an array of bytes.
SmartID3v1(ID3Tag oldTag)
          Constructor from an implementor of Tag.
SmartID3v1(ID3v1 oldTag)
          Constructor copying data from another ID3v1 tag.
 
Method Summary
 byte getGenre()
          Returns a byte representing the genre of the track.
 void setGenre(byte genre)
          Set the byte representing the genre of the track.
 
Methods inherited from class com.tffenterprises.music.tag.ID3v1
CheckFileForTag, clone, equals, getAlbum, getArtist, getBytes, getBytes, getChecksum, getComment, GetTagLength, GetTagOffset, getTitle, getTrackNumber, getYear, hashCode, isChanged, setAlbum, setArtist, setChanged, setComment, setGenre, setTitle, setTrackNumber, setYear, toString, ValidateYear, writeTo, writeTo
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.tffenterprises.music.tag.ID3Tag
getAlbum, getArtist, getBytes, getComment, getTitle, getTrackNumber, getYear, isChanged, setAlbum, setArtist, setChanged, setComment, setTitle, setTrackNumber, setYear, toString
 

Constructor Detail

SmartID3v1

public SmartID3v1(byte[] byteArray)
           throws java.lang.IllegalArgumentException
Constructor from an array of bytes. Note that the array of bytes passed to this constructor will neither be retained nor modified.

Parameters:
byteArray - an array of 125 bytes containing the data from which the ID3v1 tag is to be extracted.
Throws:
java.lang.IllegalArgumentException - if the array is not 125 bytes long.

SmartID3v1

public SmartID3v1()
Default constructor. All the strings will be set to the empty string, and all numerical values will be set to -1 (the "unknown" value).


SmartID3v1

public SmartID3v1(ID3Tag oldTag)
Constructor from an implementor of Tag. Every tag value will be copied (up to their maximum length).

Parameters:
oldTag - the ID3 instance from which to copy this ID3v1 object.

SmartID3v1

public SmartID3v1(ID3v1 oldTag)
Constructor copying data from another ID3v1 tag.

Parameters:
oldTag - the ID3v1 instance to be copied.
Method Detail

getGenre

public byte getGenre()
Returns a byte representing the genre of the track. Given that this version of ID3v1 simply ignores the genre, the method simply returns -1.

Specified by:
getGenre in interface ID3Tag
Overrides:
getGenre in class ID3v1
Returns:
a byte representing the genre of the track, namely -1.

setGenre

public void setGenre(byte genre)
Set the byte representing the genre of the track.

Specified by:
setGenre in interface ID3Tag
Overrides:
setGenre in class ID3v1
Parameters:
genre - the byte representing the genre of the track.