public class AsciiHexInterpreter extends java.lang.Object implements BinaryInterpreter
Modifier and Type | Field and Description |
---|---|
static AsciiHexInterpreter |
INSTANCE
An instance of this Interpreter.
|
Constructor and Description |
---|
AsciiHexInterpreter() |
Modifier and Type | Method and Description |
---|---|
int |
getPackedLength(int nBytes)
Returns double nBytes because the hex representation of 1 byte needs 2 hex digits.
|
void |
interpret(byte[] data,
byte[] b,
int offset)
Converts the binary data into ASCII hex digits.
|
byte[] |
uninterpret(byte[] rawData,
int offset,
int length)
Converts the ASCII hex digits into binary data.
|
public static final AsciiHexInterpreter INSTANCE
public void interpret(byte[] data, byte[] b, int offset)
interpret
in interface BinaryInterpreter
data
- The data to be interpreted.b
- The byte array to write the interpreted data to.offset
- The starting position in b.public byte[] uninterpret(byte[] rawData, int offset, int length)
uninterpret
in interface BinaryInterpreter
rawData
- The interpreted data.offset
- The index in rawData to start uninterpreting at.length
- The number of uninterpreted bytes to uninterpret. This number may be
different from the number of raw bytes that are uninterpreted.public int getPackedLength(int nBytes)
getPackedLength
in interface BinaryInterpreter