FileDocCategorySizeDatePackage
Tag.javaAPI DocJaudiotagger 2.0.410662Tue Dec 06 11:50:52 GMT 2011org.jaudiotagger.tag

Tag

public interface Tag
This interface represents the basic data structure for the default audio library 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.
The addField() method can be used for this but it is possible the underlying implementation does not support that kind of storing multiple values and will just overwrite the existing value

Code Examples:


AudioFile file = AudioFileIO.read(new File("C:\\test.mp3"));

Tag tag = file.getTag();

author
Raphael Slinckx
author
Paul Taylor

Fields Summary
Constructors Summary
Methods Summary
public voidaddField(FieldKey genericKey, java.lang.String value)
Create the field based on the generic key and add it to the tag This is handled differently by different formats

param
genericKey
param
value
throws
KeyNotFoundException
throws
FieldDataInvalidException

public voidaddField(org.jaudiotagger.tag.images.Artwork artwork)
Create artwork field based on the data in artwork and then add it to the tag itself

param
artwork
throws
FieldDataInvalidException

public voidaddField(TagField field)
Adds a field to the structure, used internally by the library

param
field The field to add.
throws
FieldDataInvalidException

public TagFieldcreateField(org.jaudiotagger.tag.images.Artwork artwork)
Create artwork field based on the data in artwork

param
artwork
return
suitable tagfield for this format that represents the artwork data
throws
FieldDataInvalidException

public TagFieldcreateField(FieldKey genericKey, java.lang.String value)
Create a new field based on generic key, used internally by the library

Only textual data supported at the moment. The genericKey will be mapped to the correct implementation key and return a TagField.

param
genericKey is the generic key
param
value to store
return
throws
KeyNotFoundException
throws
FieldDataInvalidException

public voiddeleteArtworkField()
Delete any instance of tag fields used to store artwork

We need this additional deleteField method because in some formats artwork can be stored in multiple fields

throws
KeyNotFoundException

public voiddeleteField(FieldKey fieldKey)
Delete any fields with this key

param
fieldKey
throws
KeyNotFoundException

public voiddeleteField(java.lang.String key)
Delete any fields with this Flac (Vorbis Comment) id

param
key
throws
KeyNotFoundException

public java.util.ListgetArtworkList()

return
a list of all artwork in this file using the format indepedent Artwork class

public intgetFieldCount()
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

return
total number of fields

public intgetFieldCountIncludingSubValues()
Return the number of fields taking multiple value fields into consideration Fields that actually contain multiple values are counted seperately i.e. a TCON frame in ID3v24 frame containing multiple genres would add to count for each genre.

return
total number of fields taking multiple value fields into consideration

public java.util.ListgetFields(java.lang.String id)
Returns a {@linkplain List list} of {@link TagField} objects whose "{@linkplain TagField#getId() id}" is the specified one.

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

param
id The field id.
return
A list of {@link TagField} objects with the given "id".

public java.util.ListgetFields(FieldKey id)
Returns a {@linkplain List list} of {@link TagField} objects whose "{@linkplain TagField#getId() id}" is the specified one.

param
id The field id.
return
A list of {@link TagField} objects with the given "id".
throws
KeyNotFoundException

public java.util.IteratorgetFields()
Iterator over all the fields within the tag, handle multiple fields with the same id

return
iterator over whole list

public java.lang.StringgetFirst(java.lang.String id)
Retrieve String value of the first value that exists for this format specific key

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

param
id
return

public java.lang.StringgetFirst(FieldKey id)
Retrieve String value of the first tag field that exists for this generic key

param
id
return
String value or empty string
throws
KeyNotFoundException

public org.jaudiotagger.tag.images.ArtworkgetFirstArtwork()

return
first artwork or null if none exist

public TagFieldgetFirstField(java.lang.String id)
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 {@link FieldKey}

param
id audio specific key
return
tag field or null if doesn't exist

public TagFieldgetFirstField(FieldKey id)

param
id
return
the first field that matches this generic key

public java.lang.StringgetSubValue(FieldKey id, int n, int m)
Retrieve String value of the mth field within the nth tag field that exists for this id

This method id useful for formats that hold multiple values within one field, namely ID3v2 can hold multiple values within one Text Frame. the #getValue() method will return all values within the frame but this method lets you retrieve just the individual values.

param
id
param
n
return

public java.lang.StringgetValue(FieldKey id, int n)
Retrieve String value of the nth tag field that exists for this generic key

param
id
param
n
return

public booleanhasCommonFields()
Returns true, if at least one of the contained {@linkplain TagField fields} is a common field ({@link TagField#isCommon()}).

return
true if a {@linkplain TagField#isCommon() common} field is present.

public booleanhasField(FieldKey fieldKey)
Determines whether the tag has at least one field with the specified field key.

param
fieldKey
return

public booleanhasField(java.lang.String id)
Determines whether the tag has at least one field with the specified "id".

param
id The field id to look for.
return
true if tag contains a {@link TagField} with the given {@linkplain TagField#getId() id}.

public booleanisEmpty()
Determines whether the tag has no fields specified.

return
true if tag contains no field.

public booleansetEncoding(java.lang.String enc)

public voidsetField(FieldKey genericKey, java.lang.String value)
Create the field based on the generic key and set it in the tag

param
genericKey
param
value
throws
KeyNotFoundException
throws
FieldDataInvalidException

public voidsetField(org.jaudiotagger.tag.images.Artwork artwork)
Create artwork field based on the data in artwork and then set it in the tag itself

param
artwork
throws
FieldDataInvalidException

public voidsetField(TagField field)
Sets a field in the structure, used internally by the library

param
field The field to add.
throws
FieldDataInvalidException

public java.lang.StringtoString()