public abstract class BitBuffer
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
BitBuffer.SimpleBitBuffer |
| Constructor and Description |
|---|
BitBuffer() |
| Modifier and Type | Method and Description |
|---|---|
static BitBuffer |
allocate(int bits) |
byte[] |
asByteArray()
This method returns representation of this bufer as
array of bytes. nota that not-full bits will be set to 0.
|
java.nio.ByteBuffer |
asByteBuffer()
This method returns representation of this bufer as
ByteBuffer. nota that not-full bits will be set to 0.
|
abstract boolean |
canRead() |
abstract boolean |
canWrite() |
abstract void |
flip()
Toggles the buffer betwen read/write modes.
|
abstract boolean |
getBoolean() |
abstract byte |
getByte() |
abstract byte |
getByte(int bits) |
float |
getFloat() |
int |
getInt() |
int |
getInt(int bits) |
java.lang.String |
getString(int length) |
java.lang.String |
getString(int length,
int bitsPerChar) |
abstract int |
limit() |
abstract int |
position() |
abstract BitBuffer |
putBoolean(boolean b)
Puts boolean value(Single bit)
|
abstract BitBuffer |
putByte(byte b)
Puts byte value(8 bits)
|
abstract BitBuffer |
putByte(byte b,
int bits)
Puts byte value with specified bit count.
|
BitBuffer |
putFloat(float f)
Puts floating point value(32 bits)
|
BitBuffer |
putInt(int i)
Puts integer value(32 bits)
|
BitBuffer |
putInt(int i,
int bits)
Puts integer value with specified bit count.
|
BitBuffer |
putString(java.lang.String s)
Puts
String value(8 bits per char), using UTF-8 |
BitBuffer |
putString(java.lang.String s,
int bitsPerChar)
Puts
String value(specified amount bits per char), using UTF-8 |
BitBuffer |
putToByteBuffer(java.nio.ByteBuffer bb)
Puts this BitBuffer into ByteBuffer
|
abstract BitBuffer |
setPosition(int newPosition)
Sets cursor position for this buffer
|
abstract int |
size() |
public abstract BitBuffer putBoolean(boolean b)
b - 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 putInt(int i, int bits)
i - value to setbits - Number of bits to usepublic BitBuffer putFloat(float f)
f - value to setpublic BitBuffer putString(java.lang.String s)
String value(8 bits per char), using UTF-8s - value to setpublic BitBuffer putString(java.lang.String s, int bitsPerChar)
String value(specified amount bits per char), using UTF-8s - value to setbitsPerChar - amount of bits to use per characterpublic abstract boolean getBoolean()
public abstract byte getByte()
public abstract byte getByte(int bits)
bits - length of value in bitspublic int getInt()
public int getInt(int bits)
bits - Length of integerpublic float getFloat()
public java.lang.String getString(int length)
length - Length of the stringpublic java.lang.String getString(int length,
int bitsPerChar)
length - Length of the stringbitsPerChar - amount of bits used per charpublic abstract void 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 int size()
public abstract int limit()
public abstract int position()
public abstract BitBuffer setPosition(int newPosition)
public static BitBuffer allocate(int bits)