public final class Hex
extends java.lang.Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
Hex.HexDecodeException |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
decodeHex(char[] data)
Converts an array of characters 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.
|
static java.lang.String |
encodeHexString(byte[] data)
Converts an array of bytes into a String 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(char[] data)
throws Hex.HexDecodeException
data - An array of characters containing hexadecimal digitsHex.HexDecodeException - 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 uppercasepublic static java.lang.String encodeHexString(byte[] data)
data - a byte[] to convert to Hex charactersprotected static int toDigit(char ch,
int index)
throws Hex.HexDecodeException
ch - A character to convert to an integer digitindex - The index of the character in the sourceHex.HexDecodeException - Thrown if ch is an illegal hex character