public class BinaryUtil
extends java.lang.Object
| Constructor and Description |
|---|
BinaryUtil() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
copy(byte[] bytes) |
static byte[] |
encodeUint16(int value) |
static byte[] |
fromHex(java.lang.String hex) |
static int |
getUint16(byte[] bytes)
Read 2 bytes as a big endian unsigned 16-bit integer.
|
static long |
getUint32(byte[] bytes)
Read 4 bytes as a big endian unsigned 32-bit integer.
|
static short |
getUint8(byte b)
Read one byte as an unsigned 8-bit integer.
|
static byte |
singleFromHex(java.lang.String hex)
Parse a single byte from two hexadecimal characters.
|
static java.lang.String |
toHex(byte[] bytes) |
public static byte[] copy(byte[] bytes)
public static java.lang.String toHex(byte[] bytes)
bytes - Bytes to encodepublic static byte[] fromHex(java.lang.String hex)
hex - String of hexadecimal digits to decode as bytes.public static byte singleFromHex(java.lang.String hex)
hex - String of hexadecimal digits to decode as bytes.public static short getUint8(byte b)
Result is of type Short because Java don't have unsigned types.
public static int getUint16(byte[] bytes)
Result is of type Int because Java don't have unsigned types.
public static long getUint32(byte[] bytes)
Result is of type Long because Java don't have unsigned types.
public static byte[] encodeUint16(int value)