de.jarnbjo.ogg
Interface LogicalOggStream

All Known Implementing Classes:
LogicalOggStreamImpl

public interface LogicalOggStream

Interface providing access to a logical Ogg stream as part of a physical Ogg stream.


Field Summary
static java.lang.String FORMAT_FLAC
           
static java.lang.String FORMAT_THEORA
           
static java.lang.String FORMAT_UNKNOWN
           
static java.lang.String FORMAT_VORBIS
           
 
Method Summary
 void close()
          Closes this stream.
 java.lang.String getFormat()
           
 long getMaximumGranulePosition()
          This method does not work if the physical Ogg stream is not seekable.
 byte[] getNextOggPacket()
          Note: To read from the stream, you must use either this method or the method getNextOggPage.
 OggPage getNextOggPage()
          Note: To read from the stream, you must use either this method or the method getNextOggPacket.
 long getTime()
           
 boolean isOpen()
          Checks if this stream is open for reading.
 void reset()
          Sets the stream's position to the beginning of the stream.
 void setTime(long granulePosition)
          This method is invoked on all logical streams when calling the same method on the physical stream.
 

Field Detail

FORMAT_UNKNOWN

public static final java.lang.String FORMAT_UNKNOWN
See Also:
Constant Field Values

FORMAT_VORBIS

public static final java.lang.String FORMAT_VORBIS
See Also:
Constant Field Values

FORMAT_FLAC

public static final java.lang.String FORMAT_FLAC
See Also:
Constant Field Values

FORMAT_THEORA

public static final java.lang.String FORMAT_THEORA
See Also:
Constant Field Values
Method Detail

getNextOggPage

public OggPage getNextOggPage()
                       throws OggFormatException,
                              java.io.IOException
Note: To read from the stream, you must use either this method or the method getNextOggPacket. Mixing calls to the two methods will cause data corruption.

Returns:
the next Ogg page
Throws:
OggFormatException - if the ogg stream is corrupted
java.io.IOException - if some other IO error occurs
See Also:
getNextOggPacket()

getNextOggPacket

public byte[] getNextOggPacket()
                        throws OggFormatException,
                               java.io.IOException
Note: To read from the stream, you must use either this method or the method getNextOggPage. Mixing calls to the two methods will cause data corruption.

Returns:
the next packet as a byte array
Throws:
OggFormatException - if the ogg stream is corrupted
java.io.IOException - if some other IO error occurs
See Also:
getNextOggPage()

isOpen

public boolean isOpen()
Checks if this stream is open for reading.

Returns:
true if this stream is open for reading, false otherwise

close

public void close()
           throws java.io.IOException
Closes this stream. After invoking this method, no further access to the streams data is possible.

Throws:
java.io.IOException - if an IO error occurs

reset

public void reset()
           throws OggFormatException,
                  java.io.IOException
Sets the stream's position to the beginning of the stream. This method does not work if the physical Ogg stream is not seekable.

Throws:
OggFormatException - if the ogg stream is corrupted
java.io.IOException - if some other IO error occurs

getMaximumGranulePosition

public long getMaximumGranulePosition()
This method does not work if the physical Ogg stream is not seekable.

Returns:
the granule position of the last page within this stream

setTime

public void setTime(long granulePosition)
             throws java.io.IOException
This method is invoked on all logical streams when calling the same method on the physical stream. The same restrictions as mentioned there apply. This method does not work if the physical Ogg stream is not seekable.

Parameters:
granulePosition -
Throws:
java.io.IOException - if an IO error occurs
See Also:
PhysicalOggStream.setTime(long)

getTime

public long getTime()
Returns:
the last parsed granule position of this stream

getFormat

public java.lang.String getFormat()
Returns:
the content type of this stream
See Also:
FORMAT_UNKNOWN, FORMAT_VORBIS, FORMAT_FLAC, FORMAT_THEORA