Class ByteArrayUtils
java.lang.Object
com.hierynomus.protocol.commons.ByteArrayUtils
Utility functions for byte arrays.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanequals(byte[] a1, int a1Offset, byte[] a2, int a2Offset, int length) Check whether some part or whole of two byte arrays is equal, forlengthbytes starting at some offset.static byte[]Parse a hexadecimal string representation to a byte array.private static intparseHexDigit(char c) static StringprintHex(byte[] array) Get a hexadecimal representation of the full byte array, with each octet separated by a space.static StringprintHex(byte[] array, int offset, int len) Get a hexadecimal representation of a byte array starting atoffsetindex forlenbytes, with each octet separated by a space.static StringtoHex(byte[] array) Get the hexadecimal representation of a byte array.static StringtoHex(byte[] array, int offset, int len) Get the hexadecimal representation of a byte array starting atoffsetindex forlenbytes.
-
Field Details
-
digits
static final char[] digits
-
-
Constructor Details
-
ByteArrayUtils
public ByteArrayUtils()
-
-
Method Details
-
equals
public static boolean equals(byte[] a1, int a1Offset, byte[] a2, int a2Offset, int length) Check whether some part or whole of two byte arrays is equal, forlengthbytes starting at some offset.- Parameters:
a1-a1Offset-a2-a2Offset-length-- Returns:
trueorfalse
-
printHex
Get a hexadecimal representation of the full byte array, with each octet separated by a space.- Parameters:
array-- Returns:
- hex string, each octet delimited by a space
-
printHex
Get a hexadecimal representation of a byte array starting atoffsetindex forlenbytes, with each octet separated by a space.- Parameters:
array-offset-len-- Returns:
- hex string, each octet delimited by a space
-
toHex
Get the hexadecimal representation of a byte array.- Parameters:
array-- Returns:
- hex string
-
toHex
Get the hexadecimal representation of a byte array starting atoffsetindex forlenbytes.- Parameters:
array-offset-len-- Returns:
- hex string
-
parseHex
Parse a hexadecimal string representation to a byte array.- Parameters:
hex- The hexadecimal string- Returns:
- the parsed byte array
-
parseHexDigit
private static int parseHexDigit(char c)
-