org.avineas.comli
public class Coder extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static int |
decode(byte[] data,
int off)
Decode an integer (actually a word) value from a byte array
|
static void |
encode(int value,
byte[] data,
int off)
Encode an integer (actually a word) value into a byte array.
|
static int |
fromHexBytes(byte[] data,
int offset,
int size)
Convert a byte array with a hex specification to an integer.
|
static byte[] |
toHexBytes(int value,
int size)
Convert an integer value to a byte array containing the ASCII representation
of the integer.
|
static void |
toHexBytes(int value,
int size,
byte[] to,
int offset)
Variant to put data immediately into a byte array.
|
public static byte[] toHexBytes(int value, int size)
value
- The value to checksize
- The size in bytes of the output arraypublic static void toHexBytes(int value, int size, byte[] to, int offset)
value
- The value to setsize
- The size in which to codeto
- The output bufferoffset
- The offset in the output bufferpublic static int fromHexBytes(byte[] data, int offset, int size)
data
- The buffer from which to decodeoffset
- The offset in the buffer to start the codingsize
- The size to usepublic static void encode(int value, byte[] data, int off)
value
- The value to encodedata
- The buffer to encode intooff
- The offset where to start codingpublic static int decode(byte[] data, int off)
data
- The buffer to decode fromoff
- The offset where to start the coding