org.tritonus.lowlevel.pogg
Class SyncState

java.lang.Object
  extended by org.tritonus.lowlevel.pogg.SyncState

public class SyncState
extends java.lang.Object

Wrapper for ogg_sync_state.


Constructor Summary
SyncState()
           
 
Method Summary
 void clear()
          Calls ogg_sync_clear().
 void free()
           
 void init()
          Calls ogg_sync_init().
 int pageOut(Page page)
          Returns a page from the stream buffer, if possible.
 int pageseek(Page page)
          Synchronizes the stream.
 void reset()
          Calls ogg_sync_reset().
 int write(byte[] abBuffer, int nBytes)
          Writes to the stream buffer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SyncState

public SyncState()
Method Detail

free

public void free()

init

public void init()
Calls ogg_sync_init().


clear

public void clear()
Calls ogg_sync_clear().


reset

public void reset()
Calls ogg_sync_reset().


write

public int write(byte[] abBuffer,
                 int nBytes)
Writes to the stream buffer.


pageseek

public int pageseek(Page page)
Synchronizes the stream. This method looks if there is a complete, valid page in the stream buffer. If a page is found, it is returned in the passed Page object.

Parameters:
page - The Page to store the result of the page search in. The content is only changed if the return value is > 0.
Returns:
if a page has been found at the current location, the length of the page in bytes is returned. If not enough data for a page is available in the stream buffer, 0 is returned. If data in the stream buffer has been skipped because there is no page at the current position, the skip amount in bytes is returned as a negative number.

pageOut

public int pageOut(Page page)
Returns a page from the stream buffer, if possible. This method searches the current data in the stream buffer for the beginning of a page. If there is one, it is returned in the passed Page object. A synchronization error is signaled by a return value of -1. However, only the first synchronization error is reported. Consecutive sync errors are suppressed.

Parameters:
page - The Page to store the result of the page search in. The content is only changed if the return value is 1.
Returns:
1 if a page has been found, 0 if there is not enough data, -1 if a synchronization error occured.