|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Tag
This interface represents the basic data structure for the default
audiolibrary functionality.
Some audio file tagging systems allow to specify multiple values for one type
of information. The artist for example. Some songs may be a cooperation of
two or more artists. Sometimes a tagging user wants to specify them in the
tag without making one long text string.
For that kind of fields, the commonly used fields have adequate
methods for adding values. But it is possible the underlying implementation
does not support that kind of storing multiple values.
Code Examples:
AudioFile file = AudioFileIO.read(new File("C:\\test.mp3"));
Tag tag = file.getTag();
Method Summary | |
---|---|
void |
add(TagField field)
Adds a tagfield to the structure. |
void |
addAlbum(java.lang.String album)
Adds an album to the tag. |
void |
addArtist(java.lang.String artist)
Adds an artist to the tag. |
void |
addComment(java.lang.String comment)
Adds a comment to the tag. |
void |
addGenre(java.lang.String genre)
Adds a genre to the tag. |
void |
addTitle(java.lang.String title)
Adds a title to the tag. |
void |
addTrack(java.lang.String track)
Adds a track to the tag. |
void |
addYear(java.lang.String year)
Adds a year to the Tag. |
TagField |
createTagField(TagFieldKey genericKey,
java.lang.String value)
Create a new TagField based on generic key |
void |
deleteTagField(TagFieldKey tagFieldKey)
Delete any instance of tag fields with this key |
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> |
get(TagFieldKey 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<TagField> |
getComment()
|
int |
getFieldCount()
Return the number of fields |
java.util.Iterator |
getFields()
Iterator over all the fields within the tag, handle multiple fields with the same id |
java.lang.String |
getFirst(java.lang.String id)
Retrieve the first value that exists for this key |
java.lang.String |
getFirst(TagFieldKey id)
Retrieve String value of first tagfield that exists for this key |
java.lang.String |
getFirstAlbum()
|
java.lang.String |
getFirstArtist()
|
java.lang.String |
getFirstComment()
|
TagField |
getFirstField(java.lang.String id)
Retrieve the first tagfield that exists for this key |
java.lang.String |
getFirstGenre()
|
java.lang.String |
getFirstTitle()
|
java.lang.String |
getFirstTrack()
|
java.lang.String |
getFirstYear()
|
java.util.List<TagField> |
getGenre()
|
java.util.List<TagField> |
getTitle()
|
java.util.List<TagField> |
getTrack()
|
java.util.List<TagField> |
getYear()
|
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. |
void |
set(TagField field)
|
void |
setAlbum(java.lang.String s)
|
void |
setArtist(java.lang.String s)
|
void |
setComment(java.lang.String s)
|
boolean |
setEncoding(java.lang.String enc)
|
void |
setGenre(java.lang.String s)
|
void |
setTitle(java.lang.String s)
|
void |
setTrack(java.lang.String s)
|
void |
setYear(java.lang.String s)
|
java.lang.String |
toString()
|
Method Detail |
---|
void add(TagField field) throws FieldDataInvalidException
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.
FieldDataInvalidException
void addAlbum(java.lang.String album) throws FieldDataInvalidException
album
- Album description
FieldDataInvalidException
void addArtist(java.lang.String artist) throws FieldDataInvalidException
artist
- Artist's name
FieldDataInvalidException
void addComment(java.lang.String comment) throws FieldDataInvalidException
comment
- Comment.
FieldDataInvalidException
void addGenre(java.lang.String genre) throws FieldDataInvalidException
genre
- Genre
FieldDataInvalidException
void addTitle(java.lang.String title) throws FieldDataInvalidException
title
- Title
FieldDataInvalidException
void addTrack(java.lang.String track) throws FieldDataInvalidException
track
- Track
FieldDataInvalidException
void addYear(java.lang.String year) throws FieldDataInvalidException
year
- Year
FieldDataInvalidException
java.util.List<TagField> get(java.lang.String id)
TagField
objects whose "id"
is the specified one.
id
- The field id.
TagField
objects with the given "id".java.util.List<TagField> getAlbum()
java.util.List<TagField> getArtist()
java.util.List<TagField> getComment()
java.util.List<TagField> getGenre()
java.util.List<TagField> getTitle()
java.util.List<TagField> getTrack()
java.util.List<TagField> getYear()
java.lang.String getFirstAlbum()
java.lang.String getFirstArtist()
java.lang.String getFirstComment()
java.lang.String getFirstGenre()
java.lang.String getFirstTitle()
java.lang.String getFirstTrack()
java.lang.String getFirstYear()
boolean hasCommonFields()
true
, if at least one of the contained
fields is a common field (TagField.isCommon()
).
true
if a common
field is present.boolean hasField(java.lang.String id)
id
- The field id to look for.
true
if tag contains a TagField
with the
given id.boolean isEmpty()
true
if tag contains no field.void set(TagField field) throws FieldDataInvalidException
field
-
FieldDataInvalidException
void setAlbum(java.lang.String s) throws FieldDataInvalidException
s
-
FieldDataInvalidException
void setArtist(java.lang.String s) throws FieldDataInvalidException
s
-
FieldDataInvalidException
void setComment(java.lang.String s) throws FieldDataInvalidException
s
-
FieldDataInvalidException
void setGenre(java.lang.String s) throws FieldDataInvalidException
s
-
FieldDataInvalidException
void setTitle(java.lang.String s) throws FieldDataInvalidException
s
-
FieldDataInvalidException
void setTrack(java.lang.String s) throws FieldDataInvalidException
s
-
FieldDataInvalidException
void setYear(java.lang.String s) throws FieldDataInvalidException
s
-
FieldDataInvalidException
TagField createTagField(TagFieldKey genericKey, java.lang.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.
genericKey
- is the generic keyvalue
- to store
KeyNotFoundException
FieldDataInvalidException
java.lang.String getFirst(java.lang.String id)
id
-
java.lang.String getFirst(TagFieldKey id) throws KeyNotFoundException
id
-
KeyNotFoundException
TagField getFirstField(java.lang.String id)
Can be used to retrieve fields with any identifier, useful if the identifier is not within the jaudiotagger enum
id
- audio specific key
java.lang.String toString()
toString
in class java.lang.Object
void deleteTagField(TagFieldKey tagFieldKey) throws KeyNotFoundException
tagFieldKey
-
KeyNotFoundException
java.util.Iterator getFields()
int getFieldCount()
Fields with the same identifiers are counted seperately i.e two title fields would contribute two to the count
boolean setEncoding(java.lang.String enc) throws FieldDataInvalidException
FieldDataInvalidException
java.util.List<TagField> get(TagFieldKey id) throws KeyNotFoundException
TagField
objects whose "id"
is the specified one.
id
- The field id.
TagField
objects with the given "id".
KeyNotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |