public abstract class BitBuffer
extends java.lang.Object
allocate(long),
allocateDirect(long)| Constructor and Description |
|---|
BitBuffer() |
| Modifier and Type | Method and Description |
|---|---|
static BitBuffer |
allocate(long bits)
Allocates new BitBuffer.
|
static BitBuffer |
allocateDirect(long bits)
Allocates new 'direct' BitBuffer.
|
static BitBuffer |
allocateDynamic()
Creates new auto-extending BitBuffer.
|
static BitBuffer |
allocateDynamic(int preallocateBits)
Creates new auto-extending BitBuffer with pre-allocated space.
|
byte[] |
asByteArray()
This method returns representation of this bufer as
array of bytes.
|
java.nio.ByteBuffer |
asByteBuffer()
This method returns representation of this bufer as
ByteBuffer.
|
abstract boolean |
canRead() |
abstract boolean |
canWrite() |
abstract BitBuffer |
flip()
Toggles the buffer betwen read/write modes.
|
abstract boolean |
getBoolean() |
abstract byte |
getByte() |
abstract byte |
getByte(int bits) |
abstract byte |
getByteUnsigned(int bits) |
double |
getDouble() |
float |
getFloat() |
int |
getInt() |
int |
getInt(int bits) |
int |
getIntUnsigned(int bits) |
long |
getLong() |
long |
getLong(int bits) |
long |
getLongUnsigned(int bits) |
java.lang.String |
getString(int length) |
java.lang.String |
getString(int length,
java.nio.charset.Charset charset) |
java.lang.String |
getString(int length,
java.nio.charset.Charset charset,
int bitsPerChar) |
java.lang.String |
getString(int length,
int bitsPerChar) |
abstract long |
limit()
This function returns Virtual 'end' of this buffer, in bits
|
abstract long |
position()
This function returns current position of cursor, in bits
|
BitBuffer |
put(BitBuffer buffer)
Reads entire given BitBuffer into this buffer
|
BitBuffer |
put(boolean bit) |
BitBuffer |
put(byte number) |
BitBuffer |
put(java.nio.ByteBuffer buffer)
Reads entire given
ByteBuffer into this buffer |
BitBuffer |
put(IBufferInsert data)
Insters given data into buffer
|
BitBuffer |
put(int number) |
BitBuffer |
put(long number) |
BitBuffer |
put(java.lang.String string) |
BitBuffer |
putBit(boolean bit)
Puts single bit(boolean value) to this buffer
|
abstract BitBuffer |
putBoolean(boolean b)
Puts boolean value(Single bit)
|
abstract BitBuffer |
putByte(byte b)
Puts signed byte value(8 bits)
|
abstract BitBuffer |
putByte(byte b,
int bits)
Puts byte value with specified bit count.
|
BitBuffer |
putDouble(double d)
Puts double floating point value(64 bits)
|
BitBuffer |
putFloat(float f)
Puts floating point value(32 bits)
|
BitBuffer |
putInt(int i)
Puts signed integer value(32 bits)
|
BitBuffer |
putInt(int i,
int bits)
Puts integer value with specified bit count.
|
BitBuffer |
putLong(long l)
Puts signed long value(64 bits)
|
BitBuffer |
putLong(long l,
int bits)
Puts long value with specified bit count.
|
BitBuffer |
putString(java.lang.String s)
Puts
String value(8 bits per char), using UTF-8 encoding |
BitBuffer |
putString(java.lang.String s,
java.nio.charset.Charset charset)
Puts
String value |
BitBuffer |
putString(java.lang.String s,
java.nio.charset.Charset charset,
int bitsPerChar)
Puts
String value(specified amount of bits per byte), using specified encoding. |
BitBuffer |
putString(java.lang.String s,
int bitsPerChar)
Puts
String value(specified amount bits per char), using ASCII encoding |
BitBuffer |
putToByteBuffer(java.nio.ByteBuffer bb)
Puts this BitBuffer into ByteBuffer
|
abstract BitBuffer |
setPosition(long newPosition)
Sets cursor position for this buffer
|
abstract long |
size()
This function returns size of this buffer, in bits
|
static BitBuffer |
wrap(byte[] array)
Wraps bitbuffer around given array instance.
|
public abstract BitBuffer putBoolean(boolean b)
b - value to setpublic BitBuffer putBit(boolean bit)
bit - value to setpublic abstract BitBuffer putByte(byte b)
b - value to setpublic abstract BitBuffer putByte(byte b, int bits)
b - value to setbits - Number of bits to usepublic BitBuffer putInt(int i)
i - value to setpublic BitBuffer putLong(long l)
l - value to setpublic BitBuffer putInt(int i, int bits)
i - value to setbits - Number of bits to usepublic BitBuffer putLong(long l, int bits)
l - value to setbits - Number of bits to usepublic BitBuffer putFloat(float f)
f - value to setpublic BitBuffer putDouble(double d)
d - value to setpublic BitBuffer putString(java.lang.String s)
String value(8 bits per char), using UTF-8 encodings - value to setpublic BitBuffer putString(java.lang.String s, java.nio.charset.Charset charset)
String values - value to setcharset - Charset to usepublic BitBuffer putString(java.lang.String s, int bitsPerChar)
String value(specified amount bits per char), using ASCII encodings - value to setbitsPerChar - amount of bits to use per characterpublic BitBuffer putString(java.lang.String s, java.nio.charset.Charset charset, int bitsPerChar)
String value(specified amount of bits per byte), using specified encoding. Use this method with care!s - value to setcharset - Charset to usebitsPerChar - amount of bits to use per characterpublic BitBuffer put(boolean bit)
bit - value to setputBoolean(boolean)public BitBuffer put(byte number)
number - value to setputByte(byte)public BitBuffer put(int number)
number - value to setputInt(int)public BitBuffer put(long number)
number - value to setputLong(long)public BitBuffer put(java.lang.String string)
string - value to setputLong(long)public BitBuffer put(BitBuffer buffer)
buffer - Readable bufferpublic BitBuffer put(java.nio.ByteBuffer buffer)
ByteBuffer into this bufferbuffer - Readable bufferpublic BitBuffer put(IBufferInsert data)
data - Instance of class implementing IBufferInsertpublic abstract boolean getBoolean()
public abstract byte getByte()
public abstract byte getByte(int bits)
bits - length of value in bitspublic abstract byte getByteUnsigned(int bits)
bits - length of value in bitspublic int getInt()
public int getInt(int bits)
bits - Length of integerpublic int getIntUnsigned(int bits)
bits - Length of integerpublic long getLong()
public long getLong(int bits)
bits - Length of long integerpublic long getLongUnsigned(int bits)
bits - Length of long integerpublic float getFloat()
public double getDouble()
public java.lang.String getString(int length)
length - Length of the stringpublic java.lang.String getString(int length,
java.nio.charset.Charset charset)
length - Length of the stringcharset - Charset to use for decodingpublic java.lang.String getString(int length,
int bitsPerChar)
length - Length of the stringbitsPerChar - amount of bits used per charpublic java.lang.String getString(int length,
java.nio.charset.Charset charset,
int bitsPerChar)
length - Length of the stringcharset - Charset to use for decodingbitsPerChar - amount of bits used per charpublic abstract BitBuffer flip()
public abstract boolean canRead()
public abstract boolean canWrite()
public byte[] asByteArray()
public java.nio.ByteBuffer asByteBuffer()
public BitBuffer putToByteBuffer(java.nio.ByteBuffer bb)
bb - ByteBuffer to put data topublic abstract long size()
public abstract long limit()
public abstract long position()
public abstract BitBuffer setPosition(long newPosition)
newPosition - position to setpublic static BitBuffer allocate(long bits)
bits - Amount of bits to allocatepublic static BitBuffer allocateDirect(long bits)
bits - Amount of bits to allocatepublic static BitBuffer allocateDynamic()
public static BitBuffer allocateDynamic(int preallocateBits)
preallocateBits - Amount of space to pre-allocate, in bitspublic static BitBuffer wrap(byte[] array)
array - A byte array to wrap this buffer around