org.jaudiotagger.tag.id3
Class ID3v11Tag

java.lang.Object
  extended by org.jaudiotagger.tag.id3.AbstractTagItem
      extended by org.jaudiotagger.tag.id3.AbstractTag
          extended by org.jaudiotagger.tag.id3.AbstractID3Tag
              extended by org.jaudiotagger.tag.id3.AbstractID3v1Tag
                  extended by org.jaudiotagger.tag.id3.ID3v1Tag
                      extended by org.jaudiotagger.tag.id3.ID3v11Tag
All Implemented Interfaces:
Tag

public class ID3v11Tag
extends ID3v1Tag

Represents an ID3v11 tag.

Author:
: Eric Farng, : Paul Taylor

Field Summary
protected static int FIELD_COMMENT_LENGTH
           
protected static int FIELD_COMMENT_POS
           
protected static int FIELD_TRACK_INDICATOR_LENGTH
           
protected static int FIELD_TRACK_INDICATOR_POS
           
protected static int FIELD_TRACK_LENGTH
           
protected static int FIELD_TRACK_POS
           
private static byte MAJOR_VERSION
           
private static byte RELEASE
           
private static byte REVISION
           
protected  byte track
          Track is held as a single byte in v1.1
protected static int TRACK_MAX_VALUE
           
protected static int TRACK_MIN_VALUE
           
protected static int TRACK_UNDEFINED
           
protected static java.lang.String TYPE_TRACK
           
 
Fields inherited from class org.jaudiotagger.tag.id3.ID3v1Tag
album, artist, BYTE_TO_UNSIGNED, comment, genre, GENRE_UNDEFINED, tagFieldToID3v1Field, title, TYPE_COMMENT, year
 
Fields inherited from class org.jaudiotagger.tag.id3.AbstractID3v1Tag
END_OF_FIELD, endofStringPattern, FIELD_ALBUM_LENGTH, FIELD_ALBUM_POS, FIELD_ARTIST_LENGTH, FIELD_ARTIST_POS, FIELD_GENRE_LENGTH, FIELD_GENRE_POS, FIELD_TAGID_LENGTH, FIELD_TAGID_POS, FIELD_TITLE_LENGTH, FIELD_TITLE_POS, FIELD_YEAR_LENGTH, FIELD_YEAR_POS, logger, TAG_DATA_LENGTH, TAG_ID, TAG_LENGTH, TYPE_ALBUM, TYPE_ARTIST, TYPE_GENRE, TYPE_TITLE, TYPE_YEAR
 
Fields inherited from class org.jaudiotagger.tag.id3.AbstractID3Tag
TAG_RELEASE
 
Fields inherited from class org.jaudiotagger.tag.id3.AbstractTag
TYPE_TAG
 
Constructor Summary
ID3v11Tag()
          Creates a new ID3v11 datatype.
ID3v11Tag(AbstractTag mp3tag)
          Creates a new ID3v11 datatype from a non v11 tag
ID3v11Tag(ID3v11Tag copyObject)
           
ID3v11Tag(java.io.RandomAccessFile file)
          Deprecated. use ID3v11Tag(RandomAccessFile,String) instead
ID3v11Tag(java.io.RandomAccessFile file, java.lang.String loggingFilename)
          Creates a new ID3v11 datatype.
 
Method Summary
 void addTrack(java.lang.String track)
           
 void createStructure()
          Create structured representation of this item.
 void deleteField(FieldKey genericKey)
          Delete any instance of tag fields with this key
 boolean equals(java.lang.Object obj)
          Compares Object with this only returns true if both v1_1 tags with all fields set to same value
 int getFieldCount()
          Return the number of fields

 java.util.List<TagField> getFields(FieldKey genericKey)
          Returns a list of TagField objects whose "id" is the specified one.
 java.lang.String getFirst(FieldKey genericKey)
          Retrieve the first value that exists for this generic key
 java.lang.String getFirstComment()
          Get Comment
 TagField getFirstField(java.lang.String id)
          Retrieve the first field that exists for this format specific key

 java.lang.String getFirstTrack()
          Return the track number as a String.
 byte getMajorVersion()
          Retrieve the Major Version
 byte getRelease()
          Retrieve the Release
 byte getRevision()
          Retrieve the Revision
 java.util.List<TagField> getTrack()
           
 boolean isEmpty()
          Determines whether the tag has no fields specified.
 void read(java.nio.ByteBuffer byteBuffer)
          Read in a tag from the ByteBuffer
 boolean seek(java.nio.ByteBuffer byteBuffer)
          Find identifier within byteBuffer to indicate that a v11 tag exists within the buffer
 void setComment(java.lang.String comment)
          Set Comment
 void setField(TagField field)
          Sets a field in the structure, used internally by the library

 void setTrack(java.lang.String trackValue)
          Set the track, v11 stores track numbers in a single byte value so can only handle a simple number in the range 0-255.
 void write(java.io.RandomAccessFile file)
          Write this representation of tag to the file indicated
 
Methods inherited from class org.jaudiotagger.tag.id3.ID3v1Tag
addField, addField, addField, createField, createField, deleteArtworkField, deleteField, getAlbum, getArtist, getArtworkList, getComment, getEncoding, getFieldCountIncludingSubValues, getFields, getFields, getFirst, getFirstAlbum, getFirstArtist, getFirstArtwork, getFirstField, getFirstGenre, getFirstTitle, getFirstYear, getGenre, getSubValue, getTitle, getValue, getYear, hasCommonFields, hasField, iterator, returnFieldToList, setAlbum, setArtist, setEncoding, setField, setField, setGenre, setTitle, setYear
 
Methods inherited from class org.jaudiotagger.tag.id3.AbstractID3v1Tag
delete, getSize, seekForV1OrV11Tag
 
Methods inherited from class org.jaudiotagger.tag.id3.AbstractID3Tag
getIdentifier, getLoggingFilename, setLoggingFilename, toString
 
Methods inherited from class org.jaudiotagger.tag.id3.AbstractTagItem
isSubsetOf
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jaudiotagger.tag.Tag
toString
 

Field Detail

TYPE_TRACK

protected static final java.lang.String TYPE_TRACK
See Also:
Constant Field Values

TRACK_UNDEFINED

protected static final int TRACK_UNDEFINED
See Also:
Constant Field Values

TRACK_MAX_VALUE

protected static final int TRACK_MAX_VALUE
See Also:
Constant Field Values

TRACK_MIN_VALUE

protected static final int TRACK_MIN_VALUE
See Also:
Constant Field Values

FIELD_COMMENT_LENGTH

protected static final int FIELD_COMMENT_LENGTH
See Also:
Constant Field Values

FIELD_COMMENT_POS

protected static final int FIELD_COMMENT_POS
See Also:
Constant Field Values

FIELD_TRACK_INDICATOR_LENGTH

protected static final int FIELD_TRACK_INDICATOR_LENGTH
See Also:
Constant Field Values

FIELD_TRACK_INDICATOR_POS

protected static final int FIELD_TRACK_INDICATOR_POS
See Also:
Constant Field Values

FIELD_TRACK_LENGTH

protected static final int FIELD_TRACK_LENGTH
See Also:
Constant Field Values

FIELD_TRACK_POS

protected static final int FIELD_TRACK_POS
See Also:
Constant Field Values

track

protected byte track
Track is held as a single byte in v1.1


RELEASE

private static final byte RELEASE
See Also:
Constant Field Values

MAJOR_VERSION

private static final byte MAJOR_VERSION
See Also:
Constant Field Values

REVISION

private static final byte REVISION
See Also:
Constant Field Values
Constructor Detail

ID3v11Tag

public ID3v11Tag()
Creates a new ID3v11 datatype.


ID3v11Tag

public ID3v11Tag(ID3v11Tag copyObject)

ID3v11Tag

public ID3v11Tag(AbstractTag mp3tag)
Creates a new ID3v11 datatype from a non v11 tag

Parameters:
mp3tag -
Throws:
java.lang.UnsupportedOperationException

ID3v11Tag

public ID3v11Tag(java.io.RandomAccessFile file,
                 java.lang.String loggingFilename)
          throws TagNotFoundException,
                 java.io.IOException
Creates a new ID3v11 datatype.

Parameters:
file -
loggingFilename -
Throws:
TagNotFoundException
java.io.IOException

ID3v11Tag

public ID3v11Tag(java.io.RandomAccessFile file)
          throws TagNotFoundException,
                 java.io.IOException
Deprecated. use ID3v11Tag(RandomAccessFile,String) instead

Creates a new ID3v11 datatype.

Parameters:
file -
Throws:
TagNotFoundException
java.io.IOException
Method Detail

getRelease

public byte getRelease()
Retrieve the Release

Overrides:
getRelease in class ID3v1Tag
Returns:

getMajorVersion

public byte getMajorVersion()
Retrieve the Major Version

Overrides:
getMajorVersion in class ID3v1Tag
Returns:

getRevision

public byte getRevision()
Retrieve the Revision

Overrides:
getRevision in class ID3v1Tag
Returns:

getFieldCount

public int getFieldCount()
Description copied from interface: Tag
Return the number of fields

Fields with the same identifiers are counted separately i.e two TITLE fields in a Vorbis Comment file would count as two

Specified by:
getFieldCount in interface Tag
Overrides:
getFieldCount in class ID3v1Tag
Returns:
total number of fields

setComment

public void setComment(java.lang.String comment)
Set Comment

Overrides:
setComment in class ID3v1Tag
Parameters:
comment -

getFirstComment

public java.lang.String getFirstComment()
Get Comment

Overrides:
getFirstComment in class ID3v1Tag
Returns:
comment

setTrack

public void setTrack(java.lang.String trackValue)
Set the track, v11 stores track numbers in a single byte value so can only handle a simple number in the range 0-255.

Parameters:
trackValue -

getFirstTrack

public java.lang.String getFirstTrack()
Return the track number as a String.

Overrides:
getFirstTrack in class ID3v1Tag
Returns:
track

addTrack

public void addTrack(java.lang.String track)

getTrack

public java.util.List<TagField> getTrack()
Overrides:
getTrack in class ID3v1Tag

setField

public void setField(TagField field)
Description copied from interface: Tag
Sets a field in the structure, used internally by the library

Specified by:
setField in interface Tag
Overrides:
setField in class ID3v1Tag
Parameters:
field - The field to add.

getFields

public java.util.List<TagField> getFields(FieldKey genericKey)
Description copied from class: ID3v1Tag
Returns a list of TagField objects whose "id" is the specified one.

Specified by:
getFields in interface Tag
Overrides:
getFields in class ID3v1Tag
Parameters:
genericKey - The generic field key
Returns:
A list of TagField objects with the given "id".

getFirst

public java.lang.String getFirst(FieldKey genericKey)
Description copied from class: ID3v1Tag
Retrieve the first value that exists for this generic key

Specified by:
getFirst in interface Tag
Overrides:
getFirst in class ID3v1Tag
Returns:
String value or empty string

getFirstField

public TagField getFirstField(java.lang.String id)
Description copied from interface: Tag
Retrieve the first field that exists for this format specific key

Can be used to retrieve fields with any identifier, useful if the identifier is not within FieldKey

Specified by:
getFirstField in interface Tag
Overrides:
getFirstField in class ID3v1Tag
Parameters:
id - audio specific key
Returns:
tag field or null if doesn't exist

isEmpty

public boolean isEmpty()
Description copied from interface: Tag
Determines whether the tag has no fields specified.

Specified by:
isEmpty in interface Tag
Overrides:
isEmpty in class ID3v1Tag
Returns:
true if tag contains no field.

deleteField

public void deleteField(FieldKey genericKey)
Delete any instance of tag fields with this key

Specified by:
deleteField in interface Tag
Overrides:
deleteField in class ID3v1Tag
Parameters:
genericKey -

equals

public boolean equals(java.lang.Object obj)
Compares Object with this only returns true if both v1_1 tags with all fields set to same value

Overrides:
equals in class ID3v1Tag
Parameters:
obj - Comparing Object
Returns:

seek

public boolean seek(java.nio.ByteBuffer byteBuffer)
Find identifier within byteBuffer to indicate that a v11 tag exists within the buffer

Overrides:
seek in class ID3v1Tag
Parameters:
byteBuffer -
Returns:
true if find header for v11 tag within buffer

read

public void read(java.nio.ByteBuffer byteBuffer)
          throws TagNotFoundException
Read in a tag from the ByteBuffer

Overrides:
read in class ID3v1Tag
Parameters:
byteBuffer - from where to read in a tag
Throws:
TagNotFoundException - if unable to read a tag in the byteBuffer

write

public void write(java.io.RandomAccessFile file)
           throws java.io.IOException
Write this representation of tag to the file indicated

Overrides:
write in class ID3v1Tag
Parameters:
file - that this tag should be written to
Throws:
java.io.IOException - thrown if there were problems writing to the file

createStructure

public void createStructure()
Description copied from class: ID3v1Tag
Create structured representation of this item.

Overrides:
createStructure in class ID3v1Tag


Copyright © 2005-2010 java.net. All Rights Reserved.