entagged.audioformats
Interface Tag


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();
 
 

Author:
Rapha�l Slinckx

Field Summary
static java.lang.String[] DEFAULT_GENRES
          This final field contains all the tags that id3v1 supports.
 
Method Summary
 void add(entagged.audioformats.generic.TagField field)
          Adds a tagfield to the structure.
It is not recommended to use this method for normal use of the audiolibrary.
 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.
 java.util.List get(java.lang.String id)
          Returns a list of TagField objects whose "id" is the specified one.
 java.util.List getAlbum()
           
 java.util.List getArtist()
           
 java.util.List getComment()
           
 java.util.Iterator getFields()
           
 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()
           
 java.util.List getGenre()
           
 java.util.List getTitle()
           
 java.util.List getTrack()
           
 java.util.List 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 merge(Tag tag)
           
 void set(entagged.audioformats.generic.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()
           
 

Field Detail

DEFAULT_GENRES

public static final java.lang.String[] DEFAULT_GENRES
This final field contains all the tags that id3v1 supports. The list has the same order as the id3v1 genres. To be perfectly compatible (with id3v1) the genre field should match one of these genre (case ignored). You can also use this list to present a list of basic (modifiable) possible choices for the genre field.

Method Detail

add

public void add(entagged.audioformats.generic.TagField field)
Adds a tagfield to the structure.
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:
  • The field is stored withoud validation
  • No conversion of data is perfomed
  • Parameters:
    field - The field to add.

    addAlbum

    public void addAlbum(java.lang.String album)
    Adds an album to the tag.

    Parameters:
    album - Album description

    addArtist

    public void addArtist(java.lang.String artist)
    Adds an artist to the tag.

    Parameters:
    artist - Artist's name

    addComment

    public void addComment(java.lang.String comment)
    Adds a comment to the tag.

    Parameters:
    comment - Comment.

    addGenre

    public void addGenre(java.lang.String genre)
    Adds a genre to the tag.

    Parameters:
    genre - Genre

    addTitle

    public void addTitle(java.lang.String title)
    Adds a title to the tag.

    Parameters:
    title - Title

    addTrack

    public void addTrack(java.lang.String track)
    Adds a track to the tag.

    Parameters:
    track - Track

    addYear

    public void addYear(java.lang.String year)
    Adds a year to the Tag.

    Parameters:
    year - Year

    get

    public java.util.List get(java.lang.String id)
    Returns a list of TagField objects whose "id" is the specified one.

    Parameters:
    id - The field id.
    Returns:
    A list of TagField objects with the given "id".

    getAlbum

    public java.util.List getAlbum()

    getArtist

    public java.util.List getArtist()

    getComment

    public java.util.List getComment()

    getFields

    public java.util.Iterator getFields()

    getFirstAlbum

    public java.lang.String getFirstAlbum()

    getFirstArtist

    public java.lang.String getFirstArtist()

    getFirstComment

    public java.lang.String getFirstComment()

    getFirstGenre

    public java.lang.String getFirstGenre()

    getFirstTitle

    public java.lang.String getFirstTitle()

    getFirstTrack

    public java.lang.String getFirstTrack()

    getFirstYear

    public java.lang.String getFirstYear()

    getGenre

    public java.util.List getGenre()

    getTitle

    public java.util.List getTitle()

    getTrack

    public java.util.List getTrack()

    getYear

    public java.util.List getYear()

    hasCommonFields

    public boolean hasCommonFields()
    Returns true, if at least one of the contained fields is a common field (TagField.isCommon()).

    Returns:
    true if a common field is present.

    hasField

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

    Parameters:
    id - The field id to look for.
    Returns:
    true if tag contains a TagField with the given id.

    isEmpty

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

    Returns:
    true if tag contains no field.

    merge

    public void merge(Tag tag)

    set

    public void set(entagged.audioformats.generic.TagField field)

    setAlbum

    public void setAlbum(java.lang.String s)

    setArtist

    public void setArtist(java.lang.String s)

    setComment

    public void setComment(java.lang.String s)

    setEncoding

    public boolean setEncoding(java.lang.String enc)

    setGenre

    public void setGenre(java.lang.String s)

    setTitle

    public void setTitle(java.lang.String s)

    setTrack

    public void setTrack(java.lang.String s)

    setYear

    public void setYear(java.lang.String s)

    toString

    public java.lang.String toString()