entagged.audioformats
Interface Tag

All Known Implementing Classes:
AbstractTag, ApeTag, GenericTag, Id3v1Tag, Id3v2Tag, Mp4Tag, OggTag, WavTag

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 String[] DEFAULT_GENRES
          This final field contains all the tags that id3v1 supports.
 
Method Summary
 void add(TagField field)
          Adds a tagfield to the structure.
It is not recommended to use this method for normal use of the audiolibrary.
 void addAlbum(String album)
          Adds an album to the tag.
 void addArtist(String artist)
          Adds an artist to the tag.
 void addComment(String comment)
          Adds a comment to the tag.
 void addGenre(String genre)
          Adds a genre to the tag.
 void addTitle(String title)
          Adds a title to the tag.
 void addTrack(String track)
          Adds a track to the tag.
 void addYear(String year)
          Adds a year to the Tag.
 List get(String id)
          Returns a list of TagField objects whose "id" is the specified one.
 List getAlbum()
           
 List getArtist()
           
 List getComment()
           
 Iterator getFields()
           
 String getFirstAlbum()
           
 String getFirstArtist()
           
 String getFirstComment()
           
 String getFirstGenre()
           
 String getFirstTitle()
           
 String getFirstTrack()
           
 String getFirstYear()
           
 List getGenre()
           
 List getTitle()
           
 List getTrack()
           
 List getYear()
           
 boolean hasCommonFields()
          Returns true, if at least one of the contained fields is a common field (TagField.isCommon()).
 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.
 void merge(Tag tag)
           
 void set(TagField field)
           
 void setAlbum(String s)
           
 void setArtist(String s)
           
 void setComment(String s)
           
 boolean setEncoding(String enc)
           
 void setGenre(String s)
           
 void setTitle(String s)
           
 void setTrack(String s)
           
 void setYear(String s)
           
 String toString()
           
 

Field Detail

DEFAULT_GENRES

static final 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

void add(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

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

    Parameters:
    album - Album description

    addArtist

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

    Parameters:
    artist - Artist's name

    addComment

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

    Parameters:
    comment - Comment.

    addGenre

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

    Parameters:
    genre - Genre

    addTitle

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

    Parameters:
    title - Title

    addTrack

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

    Parameters:
    track - Track

    addYear

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

    Parameters:
    year - Year

    get

    List get(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

    List getAlbum()

    getArtist

    List getArtist()

    getComment

    List getComment()

    getFields

    Iterator getFields()

    getFirstAlbum

    String getFirstAlbum()

    getFirstArtist

    String getFirstArtist()

    getFirstComment

    String getFirstComment()

    getFirstGenre

    String getFirstGenre()

    getFirstTitle

    String getFirstTitle()

    getFirstTrack

    String getFirstTrack()

    getFirstYear

    String getFirstYear()

    getGenre

    List getGenre()

    getTitle

    List getTitle()

    getTrack

    List getTrack()

    getYear

    List getYear()

    hasCommonFields

    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

    boolean hasField(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

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

    Returns:
    true if tag contains no field.

    merge

    void merge(Tag tag)

    set

    void set(TagField field)

    setAlbum

    void setAlbum(String s)

    setArtist

    void setArtist(String s)

    setComment

    void setComment(String s)

    setEncoding

    boolean setEncoding(String enc)

    setGenre

    void setGenre(String s)

    setTitle

    void setTitle(String s)

    setTrack

    void setTrack(String s)

    setYear

    void setYear(String s)

    toString

    String toString()
    Overrides:
    toString in class Object


    Copyright © 2007-2008. All Rights Reserved.