public class ID3v1Tag extends AbstractID3v1Tag implements Tag
Modifier and Type | Field and Description |
---|---|
protected String |
album |
protected String |
artist |
protected static int |
BYTE_TO_UNSIGNED |
protected String |
comment |
protected static int |
FIELD_COMMENT_LENGTH |
protected static int |
FIELD_COMMENT_POS |
protected byte |
genre |
protected static int |
GENRE_UNDEFINED |
protected String |
title |
protected static String |
TYPE_COMMENT |
protected String |
year |
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, TAG_DATA_LENGTH, TAG_ID, TAG_LENGTH, TYPE_ALBUM, TYPE_ARTIST, TYPE_GENRE, TYPE_TITLE, TYPE_YEAR
TAG_RELEASE
TYPE_TAG
Constructor and Description |
---|
ID3v1Tag()
Creates a new ID3v1 datatype.
|
ID3v1Tag(AbstractTag mp3tag) |
ID3v1Tag(ID3v1Tag copyObject) |
ID3v1Tag(RandomAccessFile file)
Deprecated.
use
ID3v1Tag(RandomAccessFile,String) instead |
ID3v1Tag(RandomAccessFile file,
String loggingFilename)
Creates a new ID3v1 datatype.
|
Modifier and Type | Method and Description |
---|---|
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,
String... value)
Create the field based on the generic key and add it to the tag
This is handled differently by different formats
|
void |
addField(TagField field)
Adds a field to the structure, used internally by the library
|
TagField |
createCompilationField(boolean value)
Creates isCompilation field
It is useful to have this method because it handles ensuring that the correct value to represent a boolean
is stored in the underlying field format.
|
TagField |
createField(Artwork artwork)
Create artwork field based on the data in artwork
|
TagField |
createField(FieldKey genericKey,
String... values)
Create Tag Field using generic key
|
void |
createStructure()
Create structured 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
|
void |
deleteField(String id)
Delete any fields with this Flac (Vorbis Comment) id
|
boolean |
equals(Object obj)
Determines whether another datatype is equal to this tag.
|
List<TagField> |
getAlbum() |
List<String> |
getAll(FieldKey genericKey)
Maps the generic key to the ogg key and return the list of values for this field as strings
|
List<TagField> |
getArtist() |
List<Artwork> |
getArtworkList() |
List<TagField> |
getComment() |
Charset |
getEncoding() |
int |
getFieldCount()
Return the number of fields
|
int |
getFieldCountIncludingSubValues()
Return the number of fields taking multiple value fields into consideration
Fields that actually contain multiple values are counted seperately
i.e.
|
Iterator<TagField> |
getFields()
Iterator over all the fields within the tag, handle multiple fields with the same id
|
List<TagField> |
getFields(FieldKey genericKey)
|
List<TagField> |
getFields(String id)
|
String |
getFirst(FieldKey genericKey)
Retrieve the first value that exists for this generic key
|
String |
getFirst(String genericKey)
Retrieve the first value that exists for this key id
|
String |
getFirstAlbum()
Get Album
|
String |
getFirstArtist()
Get Artist
|
Artwork |
getFirstArtwork() |
String |
getFirstComment()
Get Comment
|
TagField |
getFirstField(FieldKey genericKey) |
TagField |
getFirstField(String id)
Retrieve the first field that exists for this format specific key
|
String |
getFirstGenre()
Get Genre
|
String |
getFirstTitle()
Get title
|
String |
getFirstTrack() |
String |
getFirstYear()
Get year
|
List<TagField> |
getGenre()
Get Genre field
|
byte |
getMajorVersion()
Retrieve the Major Version
|
byte |
getRelease()
Retrieve the Release
|
byte |
getRevision()
Retrieve the Revision
|
String |
getSubValue(FieldKey id,
int n,
int m)
The m parameter is effectively ignored
|
List<TagField> |
getTitle()
Get title field
|
List<TagField> |
getTrack() |
String |
getValue(FieldKey genericKey,
int index)
Retrieve String value of the nth tag field that exists for this generic key
|
List<TagField> |
getYear()
Get year field
|
boolean |
hasCommonFields()
|
boolean |
hasField(FieldKey genericKey)
Determines whether the tag has at least one field with the specified field key.
|
boolean |
hasField(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.
|
Iterator |
iterator() |
void |
read(ByteBuffer byteBuffer) |
protected List<TagField> |
returnFieldToList(ID3v1TagField field) |
boolean |
seek(ByteBuffer byteBuffer)
Does a tag of this version exist within the byteBuffer
|
void |
setAlbum(String album)
Set Album
|
void |
setArtist(String artist)
Set Artist
|
void |
setComment(String comment)
Set Comment
|
boolean |
setEncoding(Charset 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,
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(String genreVal)
Sets the genreID,
|
void |
setTitle(String title)
Set Title
|
void |
setYear(String year)
Set year
|
void |
write(RandomAccessFile file)
Write this tag to the file, replacing any tag previously existing
|
delete, getSize, seekForV1OrV11Tag
getIdentifier, getLoggingFilename, setLoggingFilename
isSubsetOf
protected static final 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 String album
protected String artist
protected String comment
protected String title
protected String year
protected byte genre
public ID3v1Tag()
public ID3v1Tag(ID3v1Tag copyObject)
public ID3v1Tag(AbstractTag mp3tag)
public ID3v1Tag(RandomAccessFile file, String loggingFilename) throws TagNotFoundException, IOException
file
- loggingFilename
- TagNotFoundException
IOException
public ID3v1Tag(RandomAccessFile file) throws TagNotFoundException, IOException
ID3v1Tag(RandomAccessFile,String)
insteadfile
- TagNotFoundException
IOException
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
public List<String> getAll(FieldKey genericKey) throws KeyNotFoundException
getAll
in interface Tag
genericKey
- KeyNotFoundException
public int getFieldCount()
Tag
Fields with the same identifiers are counted separately i.e two TITLE fields in a Vorbis Comment file would count as two
getFieldCount
in interface Tag
public int getFieldCountIncludingSubValues()
Tag
getFieldCountIncludingSubValues
in interface Tag
protected List<TagField> returnFieldToList(ID3v1TagField field)
public void setAlbum(String album)
album
- public String getFirstAlbum()
public void setArtist(String artist)
artist
- public String getFirstArtist()
public void setComment(String comment)
comment
- IllegalArgumentException
- if comment nullpublic List<TagField> getComment()
public String getFirstComment()
public void setGenre(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 String getFirstGenre()
public List<TagField> getGenre()
Only a single genre is available in ID3v1
public void setTitle(String title)
title
- public String getFirstTitle()
public List<TagField> getTitle()
Only a single title is available in ID3v1
public void setYear(String year)
year
- public String getFirstYear()
public List<TagField> getYear()
Only a single year is available in ID3v1
public String getFirstTrack()
public TagField getFirstField(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 keypublic Iterator<TagField> getFields()
Tag
public boolean hasCommonFields()
Tag
hasCommonFields
in interface Tag
true
if a common
field is present.public boolean hasField(FieldKey genericKey)
Tag
public boolean hasField(String id)
Tag
public boolean isEmpty()
Tag
public void setField(FieldKey genericKey, String... value) throws KeyNotFoundException, FieldDataInvalidException
Tag
setField
in interface Tag
KeyNotFoundException
FieldDataInvalidException
public void addField(FieldKey genericKey, String... value) throws KeyNotFoundException, FieldDataInvalidException
Tag
addField
in interface Tag
KeyNotFoundException
FieldDataInvalidException
public void setField(TagField field)
Tag
public boolean setEncoding(Charset encoding)
setEncoding
in interface Tag
public TagField createField(FieldKey genericKey, String... values)
createField
in interface Tag
genericKey
- is the generic keyvalues
- to storepublic Charset getEncoding()
public TagField getFirstField(FieldKey genericKey)
getFirstField
in interface Tag
public String getFirst(String genericKey)
public String getFirst(FieldKey genericKey)
public String getSubValue(FieldKey id, int n, int m)
id
- n
- m
- public String getValue(FieldKey genericKey, int index)
Tag
public void deleteField(FieldKey genericKey)
deleteField
in interface Tag
genericKey
- public void deleteField(String id)
Tag
deleteField
in interface Tag
public boolean equals(Object obj)
AbstractTag
super.equals(obj)
.equals
in class AbstractTag
obj
- public Iterator iterator()
iterator
in class AbstractTag
public void read(ByteBuffer byteBuffer) throws TagNotFoundException
read
in class AbstractTagItem
byteBuffer
- TagNotFoundException
public boolean seek(ByteBuffer byteBuffer)
seek
in class AbstractTag
public void write(RandomAccessFile file) throws IOException
write
in class AbstractTag
file
- IOException
public void createStructure()
public 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
public TagField createCompilationField(boolean value) throws KeyNotFoundException, FieldDataInvalidException
Tag
createCompilationField
in interface Tag
KeyNotFoundException
FieldDataInvalidException
Copyright © 2005–2020 jthink.net. All rights reserved.