org.gagravarr.vorbis
Class VorbisFile

java.lang.Object
  extended by org.gagravarr.vorbis.VorbisFile

public class VorbisFile
extends Object

This is a wrapper around an OggFile that lets you get at all the interesting bits


Constructor Summary
VorbisFile(File f)
          Opens the given file for reading
VorbisFile(OggFile ogg)
          Opens the given file for reading
VorbisFile(OggPacketReader r)
          Loads a Vorbis File from the given packet reader.
VorbisFile(OutputStream out)
          Opens for writing.
VorbisFile(OutputStream out, int sid, VorbisInfo info, VorbisComments comments, VorbisSetup setup)
          Opens for writing, based on the settings from a pre-read file, with a specific Steam ID (SID).
VorbisFile(OutputStream out, VorbisInfo info, VorbisComments comments, VorbisSetup setup)
          Opens for writing, based on the settings from a pre-read file.
 
Method Summary
 void close()
          In Reading mode, will close the underlying ogg file and free its resources.
 VorbisComments getComment()
           
 VorbisInfo getInfo()
           
 VorbisAudioData getNextAudioPacket()
           
 OggFile getOggFile()
          Returns the underlying Ogg File instance
 VorbisSetup getSetup()
           
 int getSid()
          Returns the Ogg Stream ID
 void skipToGranule(long granulePosition)
          Skips the audio data to the next packet with a granule of at least the given granule position.
 void writeAudioData(VorbisAudioData data)
          Buffers the given audio ready for writing out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VorbisFile

public VorbisFile(File f)
           throws IOException,
                  FileNotFoundException
Opens the given file for reading

Throws:
IOException
FileNotFoundException

VorbisFile

public VorbisFile(OggFile ogg)
           throws IOException
Opens the given file for reading

Throws:
IOException

VorbisFile

public VorbisFile(OggPacketReader r)
           throws IOException
Loads a Vorbis File from the given packet reader.

Throws:
IOException

VorbisFile

public VorbisFile(OutputStream out)
Opens for writing.


VorbisFile

public VorbisFile(OutputStream out,
                  VorbisInfo info,
                  VorbisComments comments,
                  VorbisSetup setup)
Opens for writing, based on the settings from a pre-read file. The Steam ID (SID) is automatically allocated for you.


VorbisFile

public VorbisFile(OutputStream out,
                  int sid,
                  VorbisInfo info,
                  VorbisComments comments,
                  VorbisSetup setup)
Opens for writing, based on the settings from a pre-read file, with a specific Steam ID (SID). You should only set the SID when copying one file to another!

Method Detail

getNextAudioPacket

public VorbisAudioData getNextAudioPacket()
                                   throws IOException
Throws:
IOException

skipToGranule

public void skipToGranule(long granulePosition)
                   throws IOException
Skips the audio data to the next packet with a granule of at least the given granule position. Note that skipping backwards is not currently supported!

Throws:
IOException

getSid

public int getSid()
Returns the Ogg Stream ID


getInfo

public VorbisInfo getInfo()

getComment

public VorbisComments getComment()

getSetup

public VorbisSetup getSetup()

writeAudioData

public void writeAudioData(VorbisAudioData data)
Buffers the given audio ready for writing out. Data won't be written out yet, you need to call close() to do that, because we assume you'll still be populating the Info/Comment/Setup objects


close

public void close()
           throws IOException
In Reading mode, will close the underlying ogg file and free its resources. In Writing mode, will write out the Info, Comments and Setup objects, and then the audio data.

Throws:
IOException

getOggFile

public OggFile getOggFile()
Returns the underlying Ogg File instance

Returns:


Copyright © 2012. All Rights Reserved.