de.jarnbjo.ogg
Class LogicalOggStreamImpl

java.lang.Object
  extended byde.jarnbjo.ogg.LogicalOggStreamImpl
All Implemented Interfaces:
LogicalOggStream

public class LogicalOggStreamImpl
extends java.lang.Object
implements LogicalOggStream


Field Summary
 
Fields inherited from interface de.jarnbjo.ogg.LogicalOggStream
FORMAT_FLAC, FORMAT_THEORA, FORMAT_UNKNOWN, FORMAT_VORBIS
 
Constructor Summary
LogicalOggStreamImpl(PhysicalOggStream source, int serialNumber)
           
 
Method Summary
 void addGranulePosition(long granulePosition)
           
 void addPageNumberMapping(int physicalPageNumber)
           
 void checkFormat(OggPage page)
           
 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogicalOggStreamImpl

public LogicalOggStreamImpl(PhysicalOggStream source,
                            int serialNumber)
Method Detail

addPageNumberMapping

public void addPageNumberMapping(int physicalPageNumber)

addGranulePosition

public void addGranulePosition(long granulePosition)

reset

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

Specified by:
reset in interface LogicalOggStream
Throws:
OggFormatException - if the ogg stream is corrupted
java.io.IOException - if some other IO error occurs

getNextOggPage

public OggPage getNextOggPage()
                       throws EndOfOggStreamException,
                              OggFormatException,
                              java.io.IOException
Description copied from interface: LogicalOggStream
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.

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

getNextOggPacket

public byte[] getNextOggPacket()
                        throws EndOfOggStreamException,
                               OggFormatException,
                               java.io.IOException
Description copied from interface: LogicalOggStream
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.

Specified by:
getNextOggPacket in interface LogicalOggStream
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
EndOfOggStreamException
See Also:
LogicalOggStream.getNextOggPage()

isOpen

public boolean isOpen()
Description copied from interface: LogicalOggStream
Checks if this stream is open for reading.

Specified by:
isOpen in interface LogicalOggStream
Returns:
true if this stream is open for reading, false otherwise

close

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

Specified by:
close in interface LogicalOggStream
Throws:
java.io.IOException - if an IO error occurs

getMaximumGranulePosition

public long getMaximumGranulePosition()
Description copied from interface: LogicalOggStream
This method does not work if the physical Ogg stream is not seekable.

Specified by:
getMaximumGranulePosition in interface LogicalOggStream
Returns:
the granule position of the last page within this stream

getTime

public long getTime()
Specified by:
getTime in interface LogicalOggStream
Returns:
the last parsed granule position of this stream

setTime

public void setTime(long granulePosition)
             throws java.io.IOException
Description copied from interface: LogicalOggStream
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.

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

checkFormat

public void checkFormat(OggPage page)

getFormat

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