public final class ByteUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
byteArray(String hexString)
Create byte array from hex string
|
static short |
getShort(byte[] bArray,
int offset)
Read short from array
|
static short |
getSW(byte[] apduBuffer)
Extract status word from APDU
|
static String |
hexString(byte[] bytes)
Convert byte array into hex string
|
static String |
hexString(byte[] bytes,
int offset,
int length)
Convert byte array into hex string
|
static void |
requireSW(byte[] apduBuffer,
int expected)
Check status word from APDU
|
static void |
requireSW(byte[] apduBuffer,
short expected)
Check status word from APDU
|
public static byte[] byteArray(String hexString)
hexString - hex stringNullPointerException - if hexString is nullpublic static String hexString(byte[] bytes)
bytes - hex stringNullPointerException - if bytes is nullpublic static String hexString(byte[] bytes, int offset, int length)
bytes - hex stringoffset - offsetlength - lengthNullPointerException - if bytes is nullpublic static short getSW(byte[] apduBuffer)
apduBuffer - APDU bytesNullPointerException - if apduBuffer is nullIllegalArgumentException - if apduBuffer.length is < 2public static void requireSW(byte[] apduBuffer,
int expected)
apduBuffer - APDU bytesexpected - expected status wordNullPointerException - if apduBuffer is nullIllegalArgumentException - if apduBuffer.length is < 2AssertionError - if expected does not match the status word from apduBufferpublic static void requireSW(byte[] apduBuffer,
short expected)
apduBuffer - APDU bytesexpected - expected status wordNullPointerException - if apduBuffer is nullIllegalArgumentException - if apduBuffer.length is < 2AssertionError - if expected does not match the status word from apduBufferpublic static short getShort(byte[] bArray,
int offset)
bArray - byte arrayoffset - offsetUtil.getShort(byte[], short)