org.gagravarr.ogg
Class OggFile

java.lang.Object
  extended by org.gagravarr.ogg.OggFile

public class OggFile
extends Object

This class takes care of reading and writing files using the Ogg container format.


Constructor Summary
OggFile(InputStream input)
          Opens a file for reading in blocking (non event) mode.
OggFile(InputStream input, OggStreamListener listener)
          Opens a file for reading in non-blocking (event) mode.
OggFile(OutputStream output)
          Opens a file for writing.
 
Method Summary
 void close()
          Closes our streams.
 OggPacketReader getPacketReader()
          Returns a reader that will allow you to read packets from the file, across all Logical Bit Streams, in the order that they occur.
 OggPacketWriter getPacketWriter()
          Creates a new Logical Bit Stream in the file, and returns a Writer for putting data into it.
 OggPacketWriter getPacketWriter(int sid)
          Creates a new Logical Bit Stream in the file, and returns a Writer for putting data into it.
protected  int getUnusedSerialNumber()
          Returns a random, but previously un-used serial number for use by a new stream
protected  void writePages(OggPage[] pages)
          Writes a (possibly series) of pages to the stream in one go.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OggFile

public OggFile(OutputStream output)
Opens a file for writing. Call getPacketWriter() to begin writing your data.


OggFile

public OggFile(InputStream input)
Opens a file for reading in blocking (non event) mode. Call getPacketReader() to begin reading the file.


OggFile

public OggFile(InputStream input,
               OggStreamListener listener)
        throws IOException
Opens a file for reading in non-blocking (event) mode. Will begin processing the file and notifying your listener immediately.

Throws:
IOException
Method Detail

close

public void close()
           throws IOException
Closes our streams. It's up to you to close any OggPacketWriter instances first!

Throws:
IOException

getPacketReader

public OggPacketReader getPacketReader()
Returns a reader that will allow you to read packets from the file, across all Logical Bit Streams, in the order that they occur.


getPacketWriter

public OggPacketWriter getPacketWriter()
Creates a new Logical Bit Stream in the file, and returns a Writer for putting data into it.


getPacketWriter

public OggPacketWriter getPacketWriter(int sid)
Creates a new Logical Bit Stream in the file, and returns a Writer for putting data into it.


writePages

protected void writePages(OggPage[] pages)
                   throws IOException
Writes a (possibly series) of pages to the stream in one go.

Throws:
IOException

getUnusedSerialNumber

protected int getUnusedSerialNumber()
Returns a random, but previously un-used serial number for use by a new stream



Copyright © 2012. All Rights Reserved.