public final class BytesUtil extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
BytesUtil.ByteArrayComparator |
| 限定符和类型 | 字段和说明 |
|---|---|
static byte[] |
EMPTY_BYTES |
| 限定符和类型 | 方法和说明 |
|---|---|
static int |
compare(byte[] a,
byte[] b) |
static BytesUtil.ByteArrayComparator |
getDefaultByteArrayComparator() |
static byte[] |
hexStringToByteArray(String s)
Convert a string representation of a hex dump to a byte array.
|
static boolean |
isEmpty(byte[] bytes) |
static byte[] |
max(byte[] a,
byte[] b) |
static byte[] |
min(byte[] a,
byte[] b) |
static byte[] |
nextBytes(byte[] bytes) |
static byte[] |
nullToEmpty(byte[] bytes) |
static String |
readUtf8(byte[] in)
This method has better performance than String#String(byte[], Charset),
See the benchmark class: Utf8Benchmark for details.
|
static String |
toHex(byte[] bytes)
Dump byte array into a hex string.
|
static byte[] |
writeUtf8(String in)
This method has better performance than String#getBytes(Charset),
See the benchmark class: Utf8Benchmark for details.
|
public static byte[] nullToEmpty(byte[] bytes)
public static boolean isEmpty(byte[] bytes)
public static byte[] writeUtf8(String in)
public static String readUtf8(byte[] in)
public static byte[] nextBytes(byte[] bytes)
public static BytesUtil.ByteArrayComparator getDefaultByteArrayComparator()
public static int compare(byte[] a,
byte[] b)
public static byte[] max(byte[] a,
byte[] b)
public static byte[] min(byte[] a,
byte[] b)
public static String toHex(byte[] bytes)
bytes - bytespublic static byte[] hexStringToByteArray(String s)
s - hex stringCopyright © 2021. All rights reserved.