public class PackedBits8 extends java.lang.Object implements PackedBits
| Modifier and Type | Field and Description |
|---|---|
byte[] |
data
Integer array used to store bits
|
int |
size
Number of bits stored
|
| Constructor and Description |
|---|
PackedBits8() |
PackedBits8(int totalBits) |
| Modifier and Type | Method and Description |
|---|---|
void |
append(int bits,
int numberOfBits,
boolean swapOrder)
Appends bits on to the end of the stack.
|
int |
arrayLength() |
int |
elementBits() |
int |
get(int which) |
int |
getArray(int index) |
void |
growArray(int amountBits,
boolean saveValue)
Increases the size of the data array so that it can store an addition number of bits
|
int |
length() |
void |
print() |
int |
read(int location,
int length,
boolean swapOrder)
Read bits from the array and store them in an int
|
void |
resize(int totalBits) |
void |
set(int which,
int value) |
static PackedBits8 |
wrap(byte[] data,
int numberOfBits) |
void |
zero() |
public byte[] data
public int size
public static PackedBits8 wrap(byte[] data, int numberOfBits)
public int get(int which)
get in interface PackedBitspublic void set(int which,
int value)
set in interface PackedBitspublic void append(int bits,
int numberOfBits,
boolean swapOrder)
bits - Storage for bits. Relevant bits start at the front.numberOfBits - Number of relevant bits in 'bits'swapOrder - If true then the first bit in 'bits' will be the last bit in this array.public int read(int location,
int length,
boolean swapOrder)
location - The index of the first bitlength - Number of bits to real up to 32swapOrder - Should the order be swapped?public int getArray(int index)
public void resize(int totalBits)
resize in interface PackedBitspublic void growArray(int amountBits,
boolean saveValue)
amountBits - Number of bits beyond 'size' that you wish the array to be able to storesaveValue - if true it will save the value of the array. If false it will not copy itpublic void zero()
zero in interface PackedBitspublic int length()
length in interface PackedBitspublic int arrayLength()
arrayLength in interface PackedBitspublic void print()
public int elementBits()
elementBits in interface PackedBits