|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.mat.collect.ArrayIntCompressed
public class ArrayIntCompressed
This class compresses fixed-size int[] in a very fast and memory efficient manner if many leading and/or trailing bits of the stored ints are not used commonly. The internal data is never copied during the process of retrieving or reconstructing objects of this class and allows for fast I/O writing and reading of the underlying byte[]. Furthermore almost no additional data is used beside the underlying byte[]. Thereby the memory consumption of this data structure is kept at a minimum to build efficient int[] caches.
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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 arrayMethod Detail |
---|
public 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 set
public byte[] toByteArray()
IntArrayCompressed
can be reconstructed.
IntArrayCompressed
can be reconstructed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |