org.jaudiotagger.tag.vorbiscomment
Class VorbisCommentTag

java.lang.Object
  extended by org.jaudiotagger.audio.generic.AbstractTag
      extended by org.jaudiotagger.tag.vorbiscomment.VorbisCommentTag
All Implemented Interfaces:
Tag

public class VorbisCommentTag
extends AbstractTag

This is the logical representation of Vorbis Comment Data


Field Summary
static java.lang.String DEFAULT_VENDOR
           
 
Constructor Summary
VorbisCommentTag()
           
 
Method Summary
 void add(TagField field)
          Add Field
 TagField createAlbumField(java.lang.String content)
          Creates a field which represents the "album".
The field will already contain the given content.
 TagField createArtistField(java.lang.String content)
          Creates a field which represents the "artist".
The field will already contain the given content.
 TagField createCommentField(java.lang.String content)
          Creates a field which represents the "comment".
The field will already contain the given content.
 TagField createGenreField(java.lang.String content)
          Creates a field which represents the "genre".
The field will already contain the given content.
 TagField createTagField(java.lang.String vorbisCommentFieldKey, java.lang.String value)
          Create Tag Field using ogg key This method is provided to allow you to create key of any value because VorbisComment allows arbitary keys.
 TagField createTagField(TagFieldKey genericKey, java.lang.String value)
          Create Tag Field using generic key
 TagField createTagField(VorbisCommentFieldKey vorbisCommentFieldKey, java.lang.String value)
          Create Tag Field using ogg key
 TagField createTitleField(java.lang.String content)
          Creates a field which represents the "title".
The field will already contain the given content.
 TagField createTrackField(java.lang.String content)
          Creates a field which represents the "track".
The field will already contain the given content.
 TagField createYearField(java.lang.String content)
          Creates a field which represents the "year".
The field will already contain the given content.
 void deleteTagField(TagFieldKey genericKey)
          Delete fields with this generic key
 void deleteTagField(VorbisCommentFieldKey vorbisCommentFieldKey)
          Delete fields with this vorbisCommentFieldKey
 java.util.List<TagField> get(TagFieldKey genericKey)
          Maps the generic key to the ogg key and return the list of values for this field
 java.util.List<TagField> get(VorbisCommentFieldKey vorbisCommentKey)
          Retrieve the first value that exists for this vorbis comment key
 byte[] getArtworkBinaryData()
          Retrieve artwork raw data
 java.lang.String getArtworkMimeType()
           
 java.lang.String getFirst(TagFieldKey genericKey)
          Retrieve the first value that exists for this generic key
 java.lang.String getFirst(VorbisCommentFieldKey vorbisCommentKey)
          Retrieve the first value that exists for this vorbis comment key
 java.lang.String getVendor()
           
 boolean isEmpty()
          Is this tag empty
 void setArtworkField(byte[] data, java.lang.String mimeType)
          Create artwork field
 void setVendor(java.lang.String vendor)
          Set the vendor, known as the encoder generally We dont want this to be blank, when written to file this field is written to a different location to all other fields but user of library can just reat it as another field
 java.lang.String toString()
          (overridden)
 
Methods inherited from class org.jaudiotagger.audio.generic.AbstractTag
addAlbum, addArtist, addComment, addGenre, addTitle, addTrack, addYear, get, getAlbum, getArtist, getComment, getFieldCount, getFields, getFirst, getFirstAlbum, getFirstArtist, getFirstComment, getFirstField, getFirstGenre, getFirstTitle, getFirstTrack, getFirstYear, getGenre, getTitle, getTrack, getYear, hasCommonFields, hasField, set, setAlbum, setArtist, setComment, setEncoding, setGenre, setTitle, setTrack, setYear
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_VENDOR

public static final java.lang.String DEFAULT_VENDOR
See Also:
Constant Field Values
Constructor Detail

VorbisCommentTag

public VorbisCommentTag()
Method Detail

createAlbumField

public TagField createAlbumField(java.lang.String content)
Description copied from class: AbstractTag
Creates a field which represents the "album".
The field will already contain the given content.

Specified by:
createAlbumField in class AbstractTag
Parameters:
content - The content of the created field.
Returns:
tagfield representing the "album"

createArtistField

public TagField createArtistField(java.lang.String content)
Description copied from class: AbstractTag
Creates a field which represents the "artist".
The field will already contain the given content.

Specified by:
createArtistField in class AbstractTag
Parameters:
content - The content of the created field.
Returns:
tagfield representing the "artist"

createCommentField

public TagField createCommentField(java.lang.String content)
Description copied from class: AbstractTag
Creates a field which represents the "comment".
The field will already contain the given content.

Specified by:
createCommentField in class AbstractTag
Parameters:
content - The content of the created field.
Returns:
tagfield representing the "comment"

createGenreField

public TagField createGenreField(java.lang.String content)
Description copied from class: AbstractTag
Creates a field which represents the "genre".
The field will already contain the given content.

Specified by:
createGenreField in class AbstractTag
Parameters:
content - The content of the created field.
Returns:
tagfield representing the "genre"

createTitleField

public TagField createTitleField(java.lang.String content)
Description copied from class: AbstractTag
Creates a field which represents the "title".
The field will already contain the given content.

Specified by:
createTitleField in class AbstractTag
Parameters:
content - The content of the created field.
Returns:
tagfield representing the "title"

createTrackField

public TagField createTrackField(java.lang.String content)
Description copied from class: AbstractTag
Creates a field which represents the "track".
The field will already contain the given content.

Specified by:
createTrackField in class AbstractTag
Parameters:
content - The content of the created field.
Returns:
tagfield representing the "track"

createYearField

public TagField createYearField(java.lang.String content)
Description copied from class: AbstractTag
Creates a field which represents the "year".
The field will already contain the given content.

Specified by:
createYearField in class AbstractTag
Parameters:
content - The content of the created field.
Returns:
tagfield representing the "year"

getVendor

public java.lang.String getVendor()
Returns:
the vendor, generically known as the encoder

setVendor

public void setVendor(java.lang.String vendor)
Set the vendor, known as the encoder generally We dont want this to be blank, when written to file this field is written to a different location to all other fields but user of library can just reat it as another field

Parameters:
vendor -

toString

public java.lang.String toString()
Description copied from class: AbstractTag
(overridden)

Specified by:
toString in interface Tag
Overrides:
toString in class AbstractTag
See Also:
Object.toString()

createTagField

public TagField createTagField(TagFieldKey genericKey,
                               java.lang.String value)
                        throws KeyNotFoundException
Create Tag Field using generic key

Specified by:
createTagField in interface Tag
Overrides:
createTagField in class AbstractTag
Parameters:
genericKey - is the generic key
value - to store
Returns:
Throws:
KeyNotFoundException

createTagField

public TagField createTagField(VorbisCommentFieldKey vorbisCommentFieldKey,
                               java.lang.String value)
                        throws KeyNotFoundException
Create Tag Field using ogg key

Parameters:
vorbisCommentFieldKey -
value -
Returns:
Throws:
KeyNotFoundException

createTagField

public TagField createTagField(java.lang.String vorbisCommentFieldKey,
                               java.lang.String value)
Create Tag Field using ogg key This method is provided to allow you to create key of any value because VorbisComment allows arbitary keys.

Parameters:
vorbisCommentFieldKey -
value -
Returns:

get

public java.util.List<TagField> get(TagFieldKey genericKey)
                             throws KeyNotFoundException
Maps the generic key to the ogg key and return the list of values for this field

Specified by:
get in interface Tag
Overrides:
get in class AbstractTag
Parameters:
genericKey -
Returns:
A list of TagField objects with the given "id".
Throws:
KeyNotFoundException

get

public java.util.List<TagField> get(VorbisCommentFieldKey vorbisCommentKey)
                             throws KeyNotFoundException
Retrieve the first value that exists for this vorbis comment key

Parameters:
vorbisCommentKey -
Returns:
Throws:
KeyNotFoundException

getFirst

public java.lang.String getFirst(TagFieldKey genericKey)
                          throws KeyNotFoundException
Retrieve the first value that exists for this generic key

Specified by:
getFirst in interface Tag
Overrides:
getFirst in class AbstractTag
Parameters:
genericKey -
Returns:
Throws:
KeyNotFoundException

getFirst

public java.lang.String getFirst(VorbisCommentFieldKey vorbisCommentKey)
                          throws KeyNotFoundException
Retrieve the first value that exists for this vorbis comment key

Parameters:
vorbisCommentKey -
Returns:
Throws:
KeyNotFoundException

deleteTagField

public void deleteTagField(TagFieldKey genericKey)
                    throws KeyNotFoundException
Delete fields with this generic key

Specified by:
deleteTagField in interface Tag
Overrides:
deleteTagField in class AbstractTag
Parameters:
genericKey -
Throws:
KeyNotFoundException

deleteTagField

public void deleteTagField(VorbisCommentFieldKey vorbisCommentFieldKey)
                    throws KeyNotFoundException
Delete fields with this vorbisCommentFieldKey

Parameters:
vorbisCommentFieldKey -
Throws:
KeyNotFoundException

setArtworkField

public void setArtworkField(byte[] data,
                            java.lang.String mimeType)
Create artwork field

Actually create two fields , the dat field and the mimetype

Parameters:
data - raw image data
mimeType - mimeType of data TODO could possibly work out mimetype from data, but unlike mp4 there is nothing to restrict to only png or jpeg images

getArtworkBinaryData

public byte[] getArtworkBinaryData()
Retrieve artwork raw data

Returns:

getArtworkMimeType

public java.lang.String getArtworkMimeType()
Returns:
mimetype

isEmpty

public boolean isEmpty()
Is this tag empty

Overridden because check for size of one because there is always a vendor tag unless just created an empty vorbis tag as part of flac tag in which case size could be zero

Specified by:
isEmpty in interface Tag
Overrides:
isEmpty in class AbstractTag
Returns:
true if tag contains no field.
See Also:
Tag.isEmpty()

add

public void add(TagField field)
Add Field

Overidden because there can only be one vendor set

Specified by:
add in interface Tag
Overrides:
add in class AbstractTag
Parameters:
field -
See Also:

Changed so add empty fields