public final class HexUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static char |
byteToChar(int value)
Converts an integer value into char.
|
static String |
byteToHex(int value)
Converts an integer value into two-chars string with leading 0.
|
static String |
prettyHexDump(@NonNull byte[] bytes)
Returns a multi-line hexadecimal dump of the specified byte array that is easy to read by humans.
|
static String |
prettyHexDump(@NonNull Bytes buffer)
Returns a multi-line hexadecimal dump of the specified
Bytes that is easy to read by humans. |
static String |
prettyHexDump(@NonNull Bytes buffer,
int offset,
int length)
Returns a multi-line hexadecimal dump of the specified
Bytes that is easy to read by humans,
starting at the given offset using the given length. |
static byte[] |
toByteArray(@NonNull String string)
Converts the string argument into an array of bytes.
|
static String |
toHexString(@NonNull byte[] bytes)
Converts an array of bytes into a string.
|
public static String toHexString(@NonNull @NonNull byte[] bytes)
bytes - an array of bytesNullpointerException - if bytes is null.public static byte[] toByteArray(@NonNull
@NonNull String string)
string - a string containing lexical representation of HEX binary.NullpointerException - if string is null.IllegalArgumentException - if string parameter does not conform to lexical
value space defined for HEX binary.public static String byteToHex(int value)
value - the value to convertpublic static char byteToChar(int value)
value - the value to convertchar representationpublic static String prettyHexDump(@NonNull @NonNull byte[] bytes)
bytes - the byte array to dumppublic static String prettyHexDump(@NonNull @NonNull Bytes buffer)
Bytes that is easy to read by humans.buffer - the byte array buffer to dumppublic static String prettyHexDump(@NonNull @NonNull Bytes buffer, int offset, int length)
Bytes that is easy to read by humans,
starting at the given offset using the given length.buffer - the byte array buffer to dumpoffset - the buffer's offsetlength - the dump's lengthCopyright © 2019 Appulse. All rights reserved.