public class MessagePackReader extends Object
Modifier and Type | Field and Description |
---|---|
private static int |
ARRAY16 |
private static int |
ARRAY32 |
private static int |
BIN16 |
private static int |
BIN32 |
private static int |
BIN8 |
private static int |
DEFINITE_xE0 |
private javajs.api.GenericBinaryDocument |
doc |
private static int |
EXT16 |
private static int |
EXT32 |
private static int |
EXT8 |
private static int |
FALSE |
private static int |
FIXEXT1 |
private static int |
FIXEXT16 |
private static int |
FIXEXT2 |
private static int |
FIXEXT4 |
private static int |
FIXEXT8 |
private static int |
FIXMAP_xF0 |
private static int |
FIXSTR_xE0 |
private static int |
FLOAT32 |
private static int |
FLOAT64 |
private static int |
INT16 |
private static int |
INT32 |
private static int |
INT64 |
private static int |
INT8 |
private boolean |
isHomo |
private static int |
MAP16 |
private static int |
MAP32 |
private static int |
NEGATIVEFIXINT_xE0 |
private static int |
NIL |
private static int |
POSITIVEFIXINT_x80 |
private static int |
STR16 |
private static int |
STR32 |
private static int |
STR8 |
private static int |
TRUE |
private static int |
UINT16 |
private static int |
UINT32 |
private static int |
UINT64 |
private static int |
UINT8 |
Constructor and Description |
---|
MessagePackReader(javajs.api.GenericBinaryDocument binaryDoc,
boolean isHomogeneousArrays) |
Modifier and Type | Method and Description |
---|---|
static Object |
decode(byte[] b)
This single method takes care of all MMTF needs.
|
private Object |
getArray(int n) |
static float[] |
getFloats(byte[] b,
int n,
float divisor)
mmtf type 1 and 11
byte[4] to float32
|
static int[] |
getInts(byte[] b,
int n)
mmtf types 2-4
Decode a byte array into a byte, short, or int array.
|
private Object |
getMap(int n) |
Object |
getNext(Object array,
int pt) |
Map<String,Object> |
readMap() |
static int[] |
rldecode32(byte[] b,
int n)
mmtf type 7
Decode an array of int32 using run-length decoding.
|
static int[] |
rldecode32Delta(byte[] b,
int n)
mmtf type 8
Decode an array of int32 using run-length decoding of a difference array.
|
static char[] |
rldecode32ToChar(byte[] b,
int n)
mmtf type 6
Decode an array of int32 using run-length decoding to one char per int.
|
static String[] |
rldecode32ToStr(byte[] b)
mmtf type 5
Decode each four bytes as a 1- to 4-character string label where a 0 byte
indicates end-of-string.
|
static float[] |
rldecodef(byte[] b,
int n,
float divisor)
mmtf type 9
Decode an array of int32 using run-length decoding and divide by a divisor
to give a float32.
|
static int[] |
unpack(byte[] b,
int nBytes,
int n)
mmtf type 14 and 15
Unpack an array of int8 or int16 to int32.
|
static float[] |
unpack16Deltaf(byte[] b,
int n,
float divisor)
mmtf type 10
Decode an array of int16 using run-length decoding of a difference array.
|
static float[] |
unpackf(byte[] b,
int nBytes,
int n,
float divisor)
mmtf type 12 and 13
Unpack an array of int8 or int16 to int32 and divide to give a float32.
|
private javajs.api.GenericBinaryDocument doc
private boolean isHomo
private static final int POSITIVEFIXINT_x80
private static final int FIXMAP_xF0
private static final int FIXSTR_xE0
private static final int NEGATIVEFIXINT_xE0
private static final int DEFINITE_xE0
private static final int NIL
private static final int FALSE
private static final int TRUE
private static final int BIN8
private static final int BIN16
private static final int BIN32
private static final int EXT8
private static final int EXT16
private static final int EXT32
private static final int FLOAT32
private static final int FLOAT64
private static final int UINT8
private static final int UINT16
private static final int UINT32
private static final int UINT64
private static final int INT8
private static final int INT16
private static final int INT32
private static final int INT64
private static final int FIXEXT1
private static final int FIXEXT2
private static final int FIXEXT4
private static final int FIXEXT8
private static final int FIXEXT16
private static final int STR8
private static final int STR16
private static final int STR32
private static final int ARRAY16
private static final int ARRAY32
private static final int MAP16
private static final int MAP32
public MessagePackReader(javajs.api.GenericBinaryDocument binaryDoc, boolean isHomogeneousArrays)
public static Object decode(byte[] b)
b
- public static float[] getFloats(byte[] b, int n, float divisor)
b
- n
- divisor
- public static int[] getInts(byte[] b, int n)
b
- n
- public static String[] rldecode32ToStr(byte[] b)
b
- a byte arraypublic static char[] rldecode32ToChar(byte[] b, int n)
b
- n
- public static int[] rldecode32(byte[] b, int n)
b
- n
- public static int[] rldecode32Delta(byte[] b, int n)
b
- n
- public static float[] rldecodef(byte[] b, int n, float divisor)
b
- n
- divisor
- public static float[] unpack16Deltaf(byte[] b, int n, float divisor)
b
- n
- divisor
- public static float[] unpackf(byte[] b, int nBytes, int n, float divisor)
b
- nBytes
- n
- divisor
- public static int[] unpack(byte[] b, int nBytes, int n)
b
- nBytes
- n
-