public class Hex extends Object
| Constructor and Description |
|---|
Hex() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
decodeHex(char[] data)
Converts an array of characters representing hexadecimal values into an array of bytes of those same values.
|
static byte[] |
decodeHex(String data)
Converts a String representing hexadecimal values into an array of bytes of those same values.
|
static char[] |
encodeHex(byte[] data)
Converts an array of bytes into an array of characters representing the hexadecimal values of each byte in order.
|
static char[] |
encodeHex(byte[] data,
boolean toLowerCase)
Converts an array of bytes into an array of characters representing the hexadecimal values of each byte in order.
|
protected static char[] |
encodeHex(byte[] data,
char[] toDigits)
Converts an array of bytes into an array of characters representing the hexadecimal values of each byte in order.
|
protected static int |
toDigit(char ch,
int index)
Converts a hexadecimal character to an integer.
|
public static byte[] decodeHex(String data) throws IllegalArgumentException
data - A String containing hexadecimal digitsIllegalArgumentException - Thrown if an odd number or illegal of characters is suppliedpublic static byte[] decodeHex(char[] data)
throws IllegalArgumentException
data - An array of characters containing hexadecimal digitsIllegalArgumentException - Thrown if an odd number or illegal of characters is suppliedpublic static char[] encodeHex(byte[] data)
data - a byte[] to convert to Hex characterspublic static char[] encodeHex(byte[] data,
boolean toLowerCase)
data - a byte[] to convert to Hex characterstoLowerCase - true converts to lowercase, false to uppercaseprotected static char[] encodeHex(byte[] data,
char[] toDigits)
data - a byte[] to convert to Hex characterstoDigits - the output alphabet (must contain at least 16 chars)protected static int toDigit(char ch,
int index)
throws IllegalArgumentException
ch - A character to convert to an integer digitindex - The index of the character in the sourceIllegalArgumentException - Thrown if ch is an illegal hex characterCopyright © 2022 The Apache Software Foundation. All rights reserved.