public class IntPacker extends Object
e.g., if bit-width is 4, then Integer '16'(10000)b is not allowed but '15'(1111)b is allowed.
| Constructor and Description |
|---|
IntPacker(int width) |
| Modifier and Type | Method and Description |
|---|---|
void |
pack8Values(int[] values,
int offset,
byte[] buf)
Encode 8 (
NUM_OF_INTS) Integers from the array 'values' with specified
bit-width to bytes. |
void |
setWidth(int width) |
void |
unpack8Values(byte[] buf,
int offset,
int[] values)
decode Integers from byte array.
|
void |
unpackAllValues(byte[] buf,
int length,
int[] values)
decode all values from 'buf' with specified offset and length decoded result will be saved in
the array named 'values'.
|
public void pack8Values(int[] values,
int offset,
byte[] buf)
NUM_OF_INTS) Integers from the array 'values' with specified
bit-width to bytes.values - - array where '8 Integers' are inoffset - - the offset of first Integer to be encodedbuf - - encoded bytes, buf size must be equal to (NUM_OF_INTS * width / 8)public void unpack8Values(byte[] buf,
int offset,
int[] values)
buf - - array where bytes are in.offset - - offset of first byte to be decoded in bufvalues - - decoded result , the length of 'values' should be @{link IntPacker#NUM_OF_INTS}public void unpackAllValues(byte[] buf,
int length,
int[] values)
buf - array where all bytes are in.length - length of bytes to be decoded in buf.values - decoded result.public void setWidth(int width)
Copyright © 2022 The Apache Software Foundation. All rights reserved.