org.xiph.speex
Class Bits
public class Bits
extends java.lang.Object
Speex bit packing and unpacking class.
- Jim Lawrence, helloNetwork.com
- Marc Gimpel, Wimba S.A. (mgimpel@horizonwimba.com)
static int | DEFAULT_BUFFER_SIZE - Default buffer size
|
private int | bitPtr - Position of the bit "cursor" within the current byte
|
private int | bytePtr - Position of the byte "cursor"
|
private byte[] | bytes - "raw" data
|
void | advance(int n) - Advance n bits.
|
byte[] | getBuffer() - Returns the current buffer array.
|
int | getBufferSize() - Returns the number of bytes used in the current buffer.
|
void | init() - Initialise the bit packing variables.
|
void | pack(int data, int nbBits) - Write N bits of the given data to the buffer.
|
int | peek() - Take a peek at the next bit.
|
void | read_from(byte[] newbytes, int offset, int len) - Read the given array into the buffer.
|
protected void | setBuffer(byte[] newBuffer) - Sets the buffer to the given value.
|
int | unpack(int nbBits) - Read the next N bits from the buffer.
|
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE
Default buffer size
bitPtr
private int bitPtr
Position of the bit "cursor" within the current byte
bytePtr
private int bytePtr
Position of the byte "cursor"
bytes
private byte[] bytes
"raw" data
advance
public void advance(int n)
Advance n bits.
n
- - the number of bits to advance.
getBuffer
public byte[] getBuffer()
Returns the current buffer array.
- the current buffer array.
getBufferSize
public int getBufferSize()
Returns the number of bytes used in the current buffer.
- the number of bytes used in the current buffer.
init
public void init()
Initialise the bit packing variables.
pack
public void pack(int data,
int nbBits)
Write N bits of the given data to the buffer.
data
- - the data to write.nbBits
- - the number of bits of the data to write.
peek
public int peek()
Take a peek at the next bit.
read_from
public void read_from(byte[] newbytes,
int offset,
int len)
Read the given array into the buffer.
newbytes
- offset
- len
-
setBuffer
protected void setBuffer(byte[] newBuffer)
Sets the buffer to the given value.
unpack
public int unpack(int nbBits)
Read the next N bits from the buffer.
nbBits
- - the number of bits to read.
- the next N bits from the buffer.
Copyright © 1999-2004 Wimba S.A. All Rights Reserved.