public class ArrayIntCompressed extends Object
Constructor and Description |
---|
ArrayIntCompressed(byte[] bytes)
Create
IntArrayCompressed from bytes formerly got from
toByteArray() . |
ArrayIntCompressed(int[] ints)
Create
IntArrayCompressed from ints representing the data to
be stored in compressed form. |
ArrayIntCompressed(int[] ints,
int offset,
int length)
Create
IntArrayCompressed from ints representing the data to
be stored in compressed form (from offset to offset+length). |
ArrayIntCompressed(int size,
int leadingClearBits,
int trailingClearBits)
Create
IntArrayCompressed from number of ints to be stored,
the number of leading and trailing clear bits. |
Modifier and Type | Method and Description |
---|---|
int |
get(int index)
Get value from the given index.
|
void |
set(int index,
int value)
Set value at the given index.
|
byte[] |
toByteArray()
Get bytes representing the internal data structure with which an
IntArrayCompressed can be reconstructed. |
public ArrayIntCompressed(byte[] bytes)
IntArrayCompressed
from bytes formerly got from
toByteArray()
.bytes
- bytes formerly got from toByteArray()
public ArrayIntCompressed(int size, int leadingClearBits, int trailingClearBits)
IntArrayCompressed
from number of ints to be stored,
the number of leading and trailing clear bits. Everything else is stored
in the internal data structure.size
- number of ints to be storedleadingClearBits
- number of leading clear bitstrailingClearBits
- number of trailing clear bitspublic ArrayIntCompressed(int[] ints)
IntArrayCompressed
from ints representing the data to
be stored in compressed form.ints
- ints representing the data to be stored in compressed formpublic ArrayIntCompressed(int[] ints, int offset, int length)
IntArrayCompressed
from ints representing the data to
be stored in compressed form (from offset to offset+length).ints
- ints representing the data to be stored in compressed formoffset
- offset from which on to compress the intslength
- number of ints to compress from the given arraypublic void set(int index, int value)
index
- index at which the value should be setvalue
- value to be set at the given indexpublic int get(int index)
index
- index at which the value should be setpublic byte[] toByteArray()
IntArrayCompressed
can be reconstructed.IntArrayCompressed
can be reconstructed