public interface Tag
AudioFile file = AudioFileIO.read(new File("C:\\test.mp3"));
Tag tag = file.getTag();
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... value)
Create a new field based on generic key, used internally by the library
|
void |
deleteArtworkField()
Delete any instance of tag fields used to store artwork
|
void |
deleteField(FieldKey fieldKey)
Delete any fields with this key
|
void |
deleteField(String key)
Delete any fields with this Flac (Vorbis Comment) id
|
List<String> |
getAll(FieldKey id)
Retrieve all String values that exist for this generic key
|
List<Artwork> |
getArtworkList() |
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 id)
|
List<TagField> |
getFields(String id)
|
String |
getFirst(FieldKey id)
Retrieve String value of the first tag field that exists for this generic key
|
String |
getFirst(String id)
Retrieve String value of the first value that exists for this format specific key
|
Artwork |
getFirstArtwork() |
TagField |
getFirstField(FieldKey id) |
TagField |
getFirstField(String id)
Retrieve the first field that exists for this format specific key
|
String |
getValue(FieldKey id,
int n)
Retrieve String value of the nth tag field that exists for this generic key
|
boolean |
hasCommonFields()
|
boolean |
hasField(FieldKey fieldKey)
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.
|
boolean |
setEncoding(Charset enc) |
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
|
String |
toString() |
void setField(FieldKey genericKey, String... value) throws KeyNotFoundException, FieldDataInvalidException
genericKey
- value
- KeyNotFoundException
FieldDataInvalidException
void addField(FieldKey genericKey, String... value) throws KeyNotFoundException, FieldDataInvalidException
genericKey
- value
- KeyNotFoundException
FieldDataInvalidException
void deleteField(FieldKey fieldKey) throws KeyNotFoundException
fieldKey
- KeyNotFoundException
void deleteField(String key) throws KeyNotFoundException
key
- KeyNotFoundException
List<TagField> getFields(String id)
TagField
objects whose "id"
is the specified one.Can be used to retrieve fields with any identifier, useful if the identifier is not within FieldKey
id
- The field id.TagField
objects with the given "id".List<TagField> getFields(FieldKey id) throws KeyNotFoundException
id
- The field id.TagField
objects with the given "id".KeyNotFoundException
Iterator<TagField> getFields()
String getFirst(String id)
Can be used to retrieve fields with any identifier, useful if the identifier is not within FieldKey
id
- String getFirst(FieldKey id) throws KeyNotFoundException
id
- KeyNotFoundException
List<String> getAll(FieldKey id) throws KeyNotFoundException
id
- KeyNotFoundException
String getValue(FieldKey id, int n)
id
- n
- TagField getFirstField(String id)
Can be used to retrieve fields with any identifier, useful if the identifier is not within FieldKey
id
- audio specific keyTagField getFirstField(FieldKey id)
id
- boolean hasCommonFields()
true
if a common
field is present.boolean hasField(FieldKey fieldKey)
fieldKey
- boolean hasField(String id)
boolean isEmpty()
true
if tag contains no field.int getFieldCount()
Fields with the same identifiers are counted separately i.e two TITLE fields in a Vorbis Comment file would count as two
int getFieldCountIncludingSubValues()
boolean setEncoding(Charset enc) throws FieldDataInvalidException
FieldDataInvalidException
List<Artwork> getArtworkList()
Artwork getFirstArtwork()
void deleteArtworkField() throws KeyNotFoundException
We need this additional deleteField method because in some formats artwork can be stored in multiple fields
KeyNotFoundException
TagField createField(Artwork artwork) throws FieldDataInvalidException
artwork
- FieldDataInvalidException
void setField(Artwork artwork) throws FieldDataInvalidException
artwork
- FieldDataInvalidException
void addField(Artwork artwork) throws FieldDataInvalidException
artwork
- FieldDataInvalidException
void setField(TagField field) throws FieldDataInvalidException
field
- The field to add.FieldDataInvalidException
void addField(TagField field) throws FieldDataInvalidException
field
- The field to add.FieldDataInvalidException
TagField createField(FieldKey genericKey, String... value) throws KeyNotFoundException, FieldDataInvalidException
Only textual data supported at the moment. The genericKey will be mapped to the correct implementation key and return a TagField. Usually the value field should only be one value, but certain fields may require more than one value currently the only field to require this is the MUSICIAN field, it should contain instrument and then performer name
genericKey
- is the generic keyvalue
- to storeKeyNotFoundException
FieldDataInvalidException
TagField createCompilationField(boolean value) throws KeyNotFoundException, FieldDataInvalidException
value
- KeyNotFoundException
FieldDataInvalidException
Copyright © 2005–2020 jthink.net. All rights reserved.