org.gagravarr.vorbis
Class VorbisComments

java.lang.Object
  extended by org.gagravarr.ogg.HighLevelOggStreamPacket
      extended by org.gagravarr.vorbis.VorbisPacket
          extended by org.gagravarr.vorbis.VorbisComments
Direct Known Subclasses:
FlacTags

public class VorbisComments
extends VorbisPacket

Holds encoder information and user specified tags


Field Summary
static String KEY_ALBUM
           
static String KEY_ARTIST
           
static String KEY_DATE
           
static String KEY_GENRE
           
static String KEY_TITLE
           
static String KEY_TRACKNUMBER
           
 
Fields inherited from class org.gagravarr.vorbis.VorbisPacket
HEADER_LENGTH_AUDIO, HEADER_LENGTH_METADATA, TYPE_COMMENTS, TYPE_INFO, TYPE_SETUP
 
Constructor Summary
VorbisComments()
           
VorbisComments(OggPacket pkt)
           
 
Method Summary
 void addComment(String tag, String comment)
          Adds a comment for a given tag
 String getAlbum()
          Returns the (first) Album, or null if no Album tags present.
 Map<String,List<String>> getAllComments()
          Returns all the comments
 String getArtist()
          Returns the (first) Artist, or null if no Artist tags present.
 List<String> getComments(String tag)
          Returns all comments for a given tag, in file order.
 String getDate()
          Returns the (first) Date, or null if no Date tags present.
 String getGenre()
          Returns the (first) Genre, or null if no Genre tags present.
protected  int getHeaderSize()
          How big is the header on this packet? For Metadata packets it's normally 7 bytes, otherwise for audio packets there is no header.
protected  String getSingleComment(String normalisedTag)
           
 String getTitle()
          Returns the (first) Title, or null if no Title tags present.
 String getTrackNumber()
          Returns the (first) track number as a literal string, eg "4" or "09", or null if no track number tags present;
 int getTrackNumberNumeric()
          Returns the track number, as converted into an integer, or -1 if not available / not numeric
 String getVendor()
           
protected static String normaliseTag(String tag)
          The tag name is case-insensitive and may consist of ASCII 0x20 through 0x7D, 0x3D (���=���) excluded.
 void removeAllComments()
          Removes all comments across all tags
 void removeComments(String tag)
          Removes all comments for a given tag.
 void setComments(String tag, List<String> comments)
          Removes any existing comments for a given tag, and replaces them with the supplied list
 void setVendor(String vendor)
           
 OggPacket write()
           
 
Methods inherited from class org.gagravarr.vorbis.VorbisPacket
create, isVorbisStream, populateMetadataHeader
 
Methods inherited from class org.gagravarr.ogg.HighLevelOggStreamPacket
getData, getOggPacket, setData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_ARTIST

public static final String KEY_ARTIST
See Also:
Constant Field Values

KEY_ALBUM

public static final String KEY_ALBUM
See Also:
Constant Field Values

KEY_TITLE

public static final String KEY_TITLE
See Also:
Constant Field Values

KEY_GENRE

public static final String KEY_GENRE
See Also:
Constant Field Values

KEY_TRACKNUMBER

public static final String KEY_TRACKNUMBER
See Also:
Constant Field Values

KEY_DATE

public static final String KEY_DATE
See Also:
Constant Field Values
Constructor Detail

VorbisComments

public VorbisComments(OggPacket pkt)

VorbisComments

public VorbisComments()
Method Detail

getHeaderSize

protected int getHeaderSize()
Description copied from class: VorbisPacket
How big is the header on this packet? For Metadata packets it's normally 7 bytes, otherwise for audio packets there is no header.

Specified by:
getHeaderSize in class VorbisPacket

getVendor

public String getVendor()

setVendor

public void setVendor(String vendor)

normaliseTag

protected static String normaliseTag(String tag)
The tag name is case-insensitive and may consist of ASCII 0x20 through 0x7D, 0x3D (���=���) excluded. ASCII 0x41 through 0x5A inclusive (characters A-Z) is to be considered equivalent to ASCII 0x61 through 0x7A inclusive (characters a-z).


getSingleComment

protected String getSingleComment(String normalisedTag)

getArtist

public String getArtist()
Returns the (first) Artist, or null if no Artist tags present.


getAlbum

public String getAlbum()
Returns the (first) Album, or null if no Album tags present.


getTitle

public String getTitle()
Returns the (first) Title, or null if no Title tags present.


getGenre

public String getGenre()
Returns the (first) Genre, or null if no Genre tags present.


getTrackNumber

public String getTrackNumber()
Returns the (first) track number as a literal string, eg "4" or "09", or null if no track number tags present;


getTrackNumberNumeric

public int getTrackNumberNumeric()
Returns the track number, as converted into an integer, or -1 if not available / not numeric


getDate

public String getDate()
Returns the (first) Date, or null if no Date tags present. Dates are normally stored in ISO8601 date format, i.e. YYYY-MM-DD


getComments

public List<String> getComments(String tag)
Returns all comments for a given tag, in file order. Will return an empty list for tags which aren't present.


removeComments

public void removeComments(String tag)
Removes all comments for a given tag.


removeAllComments

public void removeAllComments()
Removes all comments across all tags


addComment

public void addComment(String tag,
                       String comment)
Adds a comment for a given tag


setComments

public void setComments(String tag,
                        List<String> comments)
Removes any existing comments for a given tag, and replaces them with the supplied list


getAllComments

public Map<String,List<String>> getAllComments()
Returns all the comments


write

public OggPacket write()
Overrides:
write in class HighLevelOggStreamPacket


Copyright © 2012. All Rights Reserved.