|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jaudiotagger.tag.id3.AbstractTagItem org.jaudiotagger.tag.id3.AbstractTag org.jaudiotagger.tag.id3.AbstractID3Tag org.jaudiotagger.tag.id3.AbstractID3v1Tag org.jaudiotagger.tag.id3.ID3v1Tag
public class ID3v1Tag
Represents an ID3v1 tag.
Field Summary | |
---|---|
protected java.lang.String |
album
|
protected java.lang.String |
artist
|
protected static int |
BYTE_TO_UNSIGNED
|
protected java.lang.String |
comment
|
protected static int |
FIELD_COMMENT_LENGTH
|
protected static int |
FIELD_COMMENT_POS
|
protected byte |
genre
|
protected static int |
GENRE_UNDEFINED
|
private static byte |
MAJOR_VERSION
|
private static byte |
RELEASE
|
private static byte |
REVISION
|
(package private) static java.util.EnumMap<FieldKey,ID3v1FieldKey> |
tagFieldToID3v1Field
|
protected java.lang.String |
title
|
protected static java.lang.String |
TYPE_COMMENT
|
protected java.lang.String |
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 | |
---|---|
ID3v1Tag()
Creates a new ID3v1 datatype. |
|
ID3v1Tag(AbstractTag mp3tag)
|
|
ID3v1Tag(ID3v1Tag copyObject)
|
|
ID3v1Tag(java.io.RandomAccessFile file)
Deprecated. use ID3v1Tag(RandomAccessFile,String) instead |
|
ID3v1Tag(java.io.RandomAccessFile file,
java.lang.String loggingFilename)
Creates a new ID3v1 datatype. |
Method Summary | |
---|---|
void |
addField(Artwork artwork)
Create artwork field based on the data in artwork and then add it to the tag itself |
void |
addField(FieldKey genericKey,
java.lang.String value)
Create the field based on the generic key and add it to the tag |
void |
addField(TagField field)
Adds a field to the structure, used internally by the library |
TagField |
createField(Artwork artwork)
Create artwork field based on the data in artwork |
TagField |
createField(FieldKey genericKey,
java.lang.String value)
Create Tag Field using generic key |
void |
createStructure()
Create strcutured representation of this item. |
void |
deleteArtworkField()
Delete all instance of artwork Field |
void |
deleteField(FieldKey genericKey)
Delete any instance of tag fields with this key |
boolean |
equals(java.lang.Object obj)
Determines whether another datatype is equal to this tag. |
java.util.List<TagField> |
get(java.lang.String id)
Returns a list of TagField objects whose "id"
is the specified one. |
java.util.List<TagField> |
getAlbum()
|
java.util.List<TagField> |
getArtist()
|
java.util.List<Artwork> |
getArtworkList()
|
java.util.List<TagField> |
getComment()
|
java.lang.String |
getEncoding()
|
int |
getFieldCount()
Return the number of fields |
java.util.Iterator<TagField> |
getFields()
Iterator over all the fields within the tag, handle multiple fields with the same id |
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 |
getFirst(java.lang.String genericKey)
Retrieve the first value that exists for this key id |
private java.lang.String |
getFirstAlbum()
Get Album |
private java.lang.String |
getFirstArtist()
Get Artist |
Artwork |
getFirstArtwork()
|
java.lang.String |
getFirstComment()
Get Comment |
TagField |
getFirstField(FieldKey genericKey)
|
TagField |
getFirstField(java.lang.String id)
Retrieve the first field that exists for this format specific key |
java.lang.String |
getFirstGenre()
Get Genre |
java.lang.String |
getFirstTitle()
Get title |
java.lang.String |
getFirstTrack()
|
java.lang.String |
getFirstYear()
Get year |
java.util.List<TagField> |
getGenre()
Get Genre field |
byte |
getMajorVersion()
Retrieve the Major Version |
byte |
getRelease()
Retrieve the Release |
byte |
getRevision()
Retrieve the Revision |
java.util.List<TagField> |
getTitle()
Get title field |
java.util.List<TagField> |
getTrack()
|
java.util.List<TagField> |
getYear()
Get year field |
boolean |
hasCommonFields()
Returns true , if at least one of the contained
fields is a common field (TagField.isCommon() ). |
boolean |
hasField(java.lang.String id)
Determines whether the tag has at least one field with the specified "id". |
boolean |
isEmpty()
Determines whether the tag has no fields specified. |
java.util.Iterator |
iterator()
|
void |
read(java.nio.ByteBuffer byteBuffer)
|
protected java.util.List<TagField> |
returnFieldToList(ID3v1TagField field)
|
boolean |
seek(java.nio.ByteBuffer byteBuffer)
Does a tag of this version exist within the byteBuffer |
void |
setAlbum(java.lang.String album)
Set Album |
void |
setArtist(java.lang.String artist)
Set Artist |
void |
setComment(java.lang.String comment)
Set Comment |
boolean |
setEncoding(java.lang.String encoding)
|
void |
setField(Artwork artwork)
Create artwork field based on the data in artwork and then set it in the tag itself |
void |
setField(FieldKey genericKey,
java.lang.String value)
Create the field based on the generic key and set it in the tag |
void |
setField(TagField field)
Sets a field in the structure, used internally by the library |
void |
setGenre(java.lang.String genreVal)
Sets the genreID, |
void |
setTitle(java.lang.String title)
Set Title |
void |
setYear(java.lang.String year)
Set year |
void |
write(java.io.RandomAccessFile file)
Write this tag to the file, replacing any tag previously existing |
Methods inherited from class org.jaudiotagger.tag.id3.AbstractID3v1Tag |
---|
delete, getSize |
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, wait, wait, wait |
Methods inherited from interface org.jaudiotagger.tag.Tag |
---|
toString |
Field Detail |
---|
static java.util.EnumMap<FieldKey,ID3v1FieldKey> tagFieldToID3v1Field
protected static final java.lang.String TYPE_COMMENT
protected static final int FIELD_COMMENT_LENGTH
protected static final int FIELD_COMMENT_POS
protected static final int BYTE_TO_UNSIGNED
protected static final int GENRE_UNDEFINED
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
private static final byte RELEASE
private static final byte MAJOR_VERSION
private static final byte REVISION
Constructor Detail |
---|
public ID3v1Tag()
public ID3v1Tag(ID3v1Tag copyObject)
public ID3v1Tag(AbstractTag mp3tag)
public ID3v1Tag(java.io.RandomAccessFile file, java.lang.String loggingFilename) throws TagNotFoundException, java.io.IOException
file
- loggingFilename
-
TagNotFoundException
java.io.IOException
public ID3v1Tag(java.io.RandomAccessFile file) throws TagNotFoundException, java.io.IOException
ID3v1Tag(RandomAccessFile,String)
instead
file
-
TagNotFoundException
java.io.IOException
Method Detail |
---|
public byte getRelease()
getRelease
in class AbstractID3Tag
public byte getMajorVersion()
getMajorVersion
in class AbstractID3Tag
public byte getRevision()
getRevision
in class AbstractID3Tag
public void addField(TagField field)
Tag
It is not recommended to use this method for normal use of the
audiolibrary. The developer will circumvent the underlying
implementation. For example, if one adds a field with the field id
"TALB" for an mp3 file, and the given
TagField
implementation does not return a text field compliant data with
TagField.getRawContent()
other software and the audio library
won't read the file correctly, if they do read it at all.
So for short:
field
- The field to add.
public java.util.List<TagField> get(java.lang.String id)
Tag
TagField
objects whose "id"
is the specified one.
get
in interface Tag
id
- The field id.
TagField
objects with the given "id".public int getFieldCount()
Tag
Fields with the same identifiers are counted seperately i.e two title fields would contribute two to the count
getFieldCount
in interface Tag
protected java.util.List<TagField> returnFieldToList(ID3v1TagField field)
public void setAlbum(java.lang.String album)
album
- private java.lang.String getFirstAlbum()
public java.util.List<TagField> getAlbum()
public void setArtist(java.lang.String artist)
artist
- private java.lang.String getFirstArtist()
public java.util.List<TagField> getArtist()
public void setComment(java.lang.String comment)
comment
-
java.lang.IllegalArgumentException
- if comment nullpublic java.util.List<TagField> getComment()
public java.lang.String getFirstComment()
public void setGenre(java.lang.String genreVal)
ID3v1 only supports genres defined in a predefined list so if unable to find value in list set 255, which seems to be the value winamp uses for undefined.
genreVal
- public java.lang.String getFirstGenre()
public java.util.List<TagField> getGenre()
Only a single genre is available in ID3v1
public void setTitle(java.lang.String title)
title
- public java.lang.String getFirstTitle()
public java.util.List<TagField> getTitle()
Only a single title is available in ID3v1
public void setYear(java.lang.String year)
year
- public java.lang.String getFirstYear()
public java.util.List<TagField> getYear()
Only a single year is available in ID3v1
public java.lang.String getFirstTrack()
public java.util.List<TagField> getTrack()
public TagField getFirstField(java.lang.String id)
Tag
Can be used to retrieve fields with any identifier, useful if the identifier is not within FieldKey
getFirstField
in interface Tag
id
- audio specific key
public java.util.Iterator<TagField> getFields()
Tag
getFields
in interface Tag
public boolean hasCommonFields()
Tag
true
, if at least one of the contained
fields is a common field (TagField.isCommon()
).
hasCommonFields
in interface Tag
true
if a common
field is present.public boolean hasField(java.lang.String id)
Tag
hasField
in interface Tag
id
- The field id to look for.
true
if tag contains a TagField
with the
given id.public boolean isEmpty()
Tag
isEmpty
in interface Tag
true
if tag contains no field.public void setField(FieldKey genericKey, java.lang.String value) throws KeyNotFoundException, FieldDataInvalidException
Tag
setField
in interface Tag
KeyNotFoundException
FieldDataInvalidException
public void addField(FieldKey genericKey, java.lang.String value) throws KeyNotFoundException, FieldDataInvalidException
Tag
addField
in interface Tag
KeyNotFoundException
FieldDataInvalidException
public void setField(TagField field)
Tag
It is not recommended to use this method for normal use of the
audiolibrary. The developer will circumvent the underlying
implementation. For example, if one adds a field with the field id
"TALB" for an mp3 file, and the given
TagField
implementation does not return a text field compliant data with
TagField.getRawContent()
other software and the audio library
won't read the file correctly, if they do read it at all.
So for short:
field
- The field to add.
public boolean setEncoding(java.lang.String encoding)
setEncoding
in interface Tag
encoding
-
public TagField createField(FieldKey genericKey, java.lang.String value)
createField
in interface Tag
genericKey
- is the generic keyvalue
- to store
public java.lang.String getEncoding()
public TagField getFirstField(FieldKey genericKey)
getFirstField
in interface Tag
public java.util.List<TagField> getFields(FieldKey genericKey)
TagField
objects whose "id"
is the specified one.
getFields
in interface Tag
genericKey
- The generic field key
TagField
objects with the given "id".public java.lang.String getFirst(java.lang.String genericKey)
getFirst
in interface Tag
genericKey
-
public java.lang.String getFirst(FieldKey genericKey)
getFirst
in interface Tag
genericKey
-
public void deleteField(FieldKey genericKey)
deleteField
in interface Tag
genericKey
- public boolean equals(java.lang.Object obj)
AbstractTag
super.equals(obj)
.
equals
in class AbstractTag
obj
-
public java.util.Iterator iterator()
iterator
in class AbstractTag
public void read(java.nio.ByteBuffer byteBuffer) throws TagNotFoundException
read
in class AbstractTagItem
byteBuffer
-
TagNotFoundException
public boolean seek(java.nio.ByteBuffer byteBuffer)
seek
in class AbstractTag
public void write(java.io.RandomAccessFile file) throws java.io.IOException
write
in class AbstractTag
file
-
java.io.IOException
public void createStructure()
public java.util.List<Artwork> getArtworkList()
getArtworkList
in interface Tag
public Artwork getFirstArtwork()
getFirstArtwork
in interface Tag
public TagField createField(Artwork artwork) throws FieldDataInvalidException
Tag
createField
in interface Tag
FieldDataInvalidException
public void setField(Artwork artwork) throws FieldDataInvalidException
Tag
setField
in interface Tag
FieldDataInvalidException
public void addField(Artwork artwork) throws FieldDataInvalidException
Tag
addField
in interface Tag
FieldDataInvalidException
public void deleteArtworkField() throws KeyNotFoundException
deleteArtworkField
in interface Tag
KeyNotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |