org.jaudiotagger.audio.ogg
Class OggVorbisTagReader

java.lang.Object
  extended by org.jaudiotagger.audio.ogg.OggVorbisTagReader

public class OggVorbisTagReader
extends java.lang.Object

Read Vorbis Comment Tag within ogg Vorbis is the audiostream within an ogg file, Vorbis uses VorbisComments as its tag


Nested Class Summary
static class OggVorbisTagReader.OggVorbisHeaderSizes
          Find the length of the raw packet data and the start position of the ogg page header they start in for the two OggVorbisHeader we need to know about when writing data (sizes included vorbis header)
 
Field Summary
static java.util.logging.Logger logger
           
 
Constructor Summary
OggVorbisTagReader()
           
 
Method Summary
 byte[] convertToVorbisSetupHeaderPacket(long fileOffsetOfStartingOggPage, java.io.RandomAccessFile raf)
          The Vorbis Seup Header may span multiple(2) pages, athough it doesnt normally.
 boolean isVorbisCommentHeader(byte[] headerData)
          Is this a Vorbis Comment header, check Note this check only applies to Vorbis Comments embedded within an OggVorbis File which is why within here
 boolean isVorbisSetupHeader(byte[] headerData)
          Is this a Vorbis SetupHeader check
 Tag read(java.io.RandomAccessFile raf)
          Read the Logical VorbisComment Tag from the file
 OggVorbisTagReader.OggVorbisHeaderSizes readOggVorbisHeaderSizes(java.io.RandomAccessFile raf)
          Calculate the size of the packet data for the comment and setup headers
 int readOggVorbisRawSize(java.io.RandomAccessFile raf)
          Retrieve the Size of the VorbisComment packet including the oggvorbis header
 byte[] readRawPacketData(java.io.RandomAccessFile raf)
          Retrieve the raw VorbisComment packet data, does not include the OggVorbis header
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static java.util.logging.Logger logger
Constructor Detail

OggVorbisTagReader

public OggVorbisTagReader()
Method Detail

read

public Tag read(java.io.RandomAccessFile raf)
         throws CannotReadException,
                java.io.IOException
Read the Logical VorbisComment Tag from the file

Read the CommenyTag, within an OggVorbis file the VorbisCommentTag is mandatory

Parameters:
raf -
Returns:
Throws:
CannotReadException
java.io.IOException

readOggVorbisRawSize

public int readOggVorbisRawSize(java.io.RandomAccessFile raf)
                         throws CannotReadException,
                                java.io.IOException
Retrieve the Size of the VorbisComment packet including the oggvorbis header

Parameters:
raf -
Returns:
Throws:
CannotReadException
java.io.IOException

readRawPacketData

public byte[] readRawPacketData(java.io.RandomAccessFile raf)
                         throws CannotReadException,
                                java.io.IOException
Retrieve the raw VorbisComment packet data, does not include the OggVorbis header

Parameters:
raf -
Returns:
Throws:
CannotReadException - if unable to find vorbiscomment header
java.io.IOException

isVorbisCommentHeader

public boolean isVorbisCommentHeader(byte[] headerData)
Is this a Vorbis Comment header, check Note this check only applies to Vorbis Comments embedded within an OggVorbis File which is why within here

Parameters:
headerData -
Returns:
true if the headerData matches a VorbisComment header i.e is a Vorbis header of type COMMENT_HEADER

isVorbisSetupHeader

public boolean isVorbisSetupHeader(byte[] headerData)
Is this a Vorbis SetupHeader check

Parameters:
headerData -
Returns:
true if matches vorbis setupheader

convertToVorbisSetupHeaderPacket

public byte[] convertToVorbisSetupHeaderPacket(long fileOffsetOfStartingOggPage,
                                               java.io.RandomAccessFile raf)
                                        throws java.io.IOException,
                                               CannotReadException
The Vorbis Seup Header may span multiple(2) pages, athough it doesnt normally. We pass the start of the file offset of the OggPage it belongs on, it probably wont be first packet.

Throws:
java.io.IOException
CannotReadException

readOggVorbisHeaderSizes

public OggVorbisTagReader.OggVorbisHeaderSizes readOggVorbisHeaderSizes(java.io.RandomAccessFile raf)
                                                                 throws CannotReadException,
                                                                        java.io.IOException
Calculate the size of the packet data for the comment and setup headers

Parameters:
raf -
Returns:
Throws:
CannotReadException
java.io.IOException