org.tritonus.lowlevel.pogg
Class Buffer

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

public class Buffer
extends java.lang.Object

Wrapper for oggpack_buffer.


Constructor Summary
Buffer()
           
 
Method Summary
 void adv(int nBits)
          Calls oggpack_adv().
 void adv1()
          Calls oggpack_adv1().
 int bits()
          Calls oggpack_bits().
 int bytes()
          Calls oggpack_bytes().
 void finalize()
           
 void free()
           
 byte[] getBuffer()
          Calls oggpack_get_buffer().
 int look(int nBits)
          Calls oggpack_look().
 int look1()
          Calls oggpack_look1().
static void outBuffer(byte[] buffer)
           
 int read(int nBits)
          Calls oggpack_read().
 int read1()
          Calls oggpack_read1().
 boolean readFlag()
          Reads a single bit.
 void readInit(byte[] abBuffer, int nBytes)
          Calls oggpack_readinit().
 java.lang.String readString()
          Reads a UTF-8 coded string with length coding.
 java.lang.String readString(int nLength)
          Reads a UTF-8 coded string without length coding.
 void reset()
          Calls oggpack_reset().
 void write(int nValue, int nBits)
          Calls oggpack_write().
 void write(java.lang.String str)
          Writes a string as UTF-8.
 void writeAlign()
          Calls oggpack_writealign().
 void writeClear()
          Calls oggpack_writeclear().
 void writeCopy(byte[] abSource, int nBits)
          Calls oggpack_writecopy().
 void writeInit()
          Calls oggpack_writeinit().
 void writeTrunc(int nBits)
          Calls oggpack_writetrunc().
 void writeWithLength(java.lang.String str)
          Writes a string as UTF-8, including a length coding.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Buffer

public Buffer()
Method Detail

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object

free

public void free()

writeInit

public void writeInit()
Calls oggpack_writeinit().


writeTrunc

public void writeTrunc(int nBits)
Calls oggpack_writetrunc().


writeAlign

public void writeAlign()
Calls oggpack_writealign().


writeCopy

public void writeCopy(byte[] abSource,
                      int nBits)
Calls oggpack_writecopy().


reset

public void reset()
Calls oggpack_reset().


writeClear

public void writeClear()
Calls oggpack_writeclear().


readInit

public void readInit(byte[] abBuffer,
                     int nBytes)
Calls oggpack_readinit().


write

public void write(int nValue,
                  int nBits)
Calls oggpack_write().


look

public int look(int nBits)
Calls oggpack_look().


look1

public int look1()
Calls oggpack_look1().


adv

public void adv(int nBits)
Calls oggpack_adv().


adv1

public void adv1()
Calls oggpack_adv1().


read

public int read(int nBits)
Calls oggpack_read().


read1

public int read1()
Calls oggpack_read1().


bytes

public int bytes()
Calls oggpack_bytes().


bits

public int bits()
Calls oggpack_bits().


getBuffer

public byte[] getBuffer()
Calls oggpack_get_buffer().


write

public void write(java.lang.String str)
Writes a string as UTF-8. Note: no length coding and no end byte are written, just the pure string!


writeWithLength

public void writeWithLength(java.lang.String str)
Writes a string as UTF-8, including a length coding. In front of the string, the length in bytes is written as a 32 bit integer. No end byte is written.


readString

public java.lang.String readString()
Reads a UTF-8 coded string with length coding. It is expected that at the current read position, there is a 32 bit integer containing the length in (UTF8-)bytes, followed by the specified number of bytes in UTF-8 coding.

Returns:
the string read from the buffer or null if an error occurs.

readString

public java.lang.String readString(int nLength)
Reads a UTF-8 coded string without length coding. It is expected that at the current read position, there is string in UTF-8 coding.

Returns:
the string read from the buffer or null if an error occurs.

readFlag

public boolean readFlag()
Reads a single bit.


outBuffer

public static void outBuffer(byte[] buffer)