public class Hexs extends Object
| 构造器和说明 |
|---|
Hexs() |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
fromHex(String hexString)
Retrieves the bytes that correspond to the provided hexadecimal string.
|
static void |
hexEncode(char c,
StringBuilder buffer)
Appends a hex-encoded representation of the provided character to the given
buffer.
|
static void |
hexEncode(int codePoint,
StringBuilder buffer)
Appends a hex-encoded representation of the provided code point to the
given buffer.
|
static boolean |
isHex(char c)
Indicates whether the provided character is a valid hexadecimal digit.
|
static String |
toHex(byte b)
Retrieves a hexadecimal representation of the provided byte.
|
static String |
toHex(byte[] b)
Retrieves a hexadecimal representation of the contents of the provided byte
array.
|
static void |
toHex(byte[] b,
StringBuilder buffer)
Retrieves a hexadecimal representation of the contents of the provided byte
array.
|
static void |
toHex(byte[] b,
String delimiter,
StringBuilder buffer)
Retrieves a hexadecimal representation of the contents of the provided byte
array.
|
static void |
toHex(byte b,
ByteStringBuffer buffer)
Appends a hexadecimal representation of the provided byte to the given
buffer.
|
static void |
toHex(byte b,
StringBuilder buffer)
Appends a hexadecimal representation of the provided byte to the given
buffer.
|
static String |
toHexPlusASCII(byte[] array,
int indent)
Retrieves a hex-encoded representation of the contents of the provided
array, along with an ASCII representation of its contents next to it.
|
static void |
toHexPlusASCII(byte[] array,
int indent,
StringBuilder buffer)
Appends a hex-encoded representation of the contents of the provided array
to the given buffer, along with an ASCII representation of its contents
next to it.
|
public static boolean isHex(char c)
c - The character for which to make the determination.true if the provided character does represent a valid
hexadecimal digit, or false if not.@NonNull public static String toHex(byte b)
b - The byte to encode as hexadecimal.public static void toHex(byte b,
@NonNull
StringBuilder buffer)
b - The byte to encode as hexadecimal.buffer - The buffer to which the hexadecimal representation is to be
appended.public static void toHex(byte b,
@NonNull
ByteStringBuffer buffer)
b - The byte to encode as hexadecimal.buffer - The buffer to which the hexadecimal representation is to be
appended.@NonNull public static String toHex(@NonNull byte[] b)
b - The byte array to be represented as a hexadecimal string. It
must not be null.public static void toHex(@NonNull byte[] b, @NonNull StringBuilder buffer)
b - The byte array to be represented as a hexadecimal string.
It must not be null.buffer - A buffer to which the hexadecimal representation of the
contents of the provided byte array should be appended.public static void toHex(@NonNull byte[] b, @Nullable String delimiter, @NonNull StringBuilder buffer)
b - The byte array to be represented as a hexadecimal
string. It must not be null.delimiter - A delimiter to be inserted between bytes. It may be
null if no delimiter should be used.buffer - A buffer to which the hexadecimal representation of the
contents of the provided byte array should be appended.@NonNull public static String toHexPlusASCII(@NonNull byte[] array, int indent)
array - The array whose contents should be processed.indent - The number of spaces to insert on each line prior to the
first hex byte.public static void toHexPlusASCII(@Nullable byte[] array, int indent, @NonNull StringBuilder buffer)
array - The array whose contents should be processed.indent - The number of spaces to insert on each line prior to the
first hex byte.buffer - The buffer to which the encoded data should be appended.@NonNull public static byte[] fromHex(@NonNull String hexString) throws ParseException
hexString - The hexadecimal string for which to retrieve the bytes.
It must not be null, and there must not be any
delimiter between bytes.ParseException - If the provided string does not represent valid
hexadecimal data, or if the provided string does
not contain an even number of characters.public static void hexEncode(char c,
@NonNull
StringBuilder buffer)
c - The character to be encoded.buffer - The buffer to which the hex-encoded representation should
be appended.public static void hexEncode(int codePoint,
@NonNull
StringBuilder buffer)
codePoint - The code point to be encoded.buffer - The buffer to which the hex-encoded representation
should be appended.Copyright © 2022. All rights reserved.