|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.basex.util.Num
public final class Num
This class provides operations to compress and decompress integer values
in byte arrays to save memory. The first four bytes of the array store the
array length. more() and next() can be called to iterate
through the stored values.
| Constructor Summary | |
|---|---|
Num(byte[] array,
boolean w)
Constructor for iterating a Num instance. |
|
| Method Summary | |
|---|---|
static byte[] |
add(byte[] array,
byte[] v)
Adds a byte array to the specified array. |
static byte[] |
add(byte[] array,
int val)
Compresses and writes an integer value to the specified byte array. |
static byte[] |
finish(byte[] array)
Finishes compressed id array. |
int |
id()
Returns next id. |
static int |
len(byte[] array,
int val)
Returns integer length. |
boolean |
more()
Checks if more numbers are to be iterated. |
static byte[] |
newNum()
Returns an empty number array. |
static byte[] |
newNum(int val)
Creates a new num array. |
void |
next()
Jumps to next id. |
int |
pos()
Returns next word position. |
static int |
read(byte[] array,
int pos)
Reads and decompresses an integer value from the specified byte array. |
static int |
size(byte[] array)
Returns length of the specified array. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Num(byte[] array,
boolean w)
Num instance.
array - array to be iteratedw - flag stating if word positions are stored in the array| Method Detail |
|---|
public static byte[] add(byte[] array,
byte[] v)
array - array to be mofifiedv - array to be added
public static byte[] add(byte[] array,
int val)
array - arrayval - value to be written
public static byte[] finish(byte[] array)
array - to be finished
public int id()
public static int len(byte[] array,
int val)
array - arrayval - integer value
public boolean more()
public static byte[] newNum()
public static byte[] newNum(int val)
val - initial value to be written
public void next()
public int pos()
public static int read(byte[] array,
int pos)
array - arraypos - position to parse
public static int size(byte[] array)
array - array to be evaluated
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||