public class Bytes extends Object
| Constructor and Description |
|---|
Bytes() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
asHex(@Nullable String hex)
check the hex string ignoring whitespace(0x20,\t\r\n)
empty string means false always
|
static boolean |
asHex(@Nullable String hex,
int len)
check the hex string ignoring whitespace(0x20,\t\r\n) and its length(0 do NOT check length)
empty string means false always
|
static @NotNull String |
hex(byte[] bytes) |
static @NotNull String |
hex(byte[] bytes,
boolean upper)
Write bytes to HEX string
|
static int |
hex(OutputStream os,
@Nullable String hex)
Parse HEX string (can contain `0x20\t\r\n` case insensitive) into stream.
|
static byte[] |
hex(@Nullable String hex)
Parse HEX string (can contain `0x20\t\r\n` case insensitive) into bytes.
|
static void |
hex(@NotNull StringBuilder sb,
byte b,
char[] table)
get HEX by lookup table
|
static boolean |
isHex(char c)
check the hex char
|
static boolean |
isHex(@Nullable String hex)
check the hex string exactly.
|
static boolean |
isHex(@Nullable String hex,
int len)
check the hex string and its length(0 do NOT check length) exactly.
|
static boolean |
isPad(char c)
check the padding white char (0x20,\t\r\n)
|
static int |
unicode(char c,
byte[] ob)
Turning a char into java's unicode format.
|
public static boolean isHex(char c)
public static boolean isPad(char c)
public static boolean isHex(@Nullable
@Nullable String hex)
public static boolean isHex(@Nullable
@Nullable String hex,
int len)
public static boolean asHex(@Nullable
@Nullable String hex)
public static boolean asHex(@Nullable
@Nullable String hex,
int len)
public static byte[] hex(@Nullable
@Nullable String hex)
public static int hex(@Param.Out OutputStream os, @Nullable @Nullable String hex)
@NotNull public static @NotNull String hex(byte[] bytes)
@NotNull public static @NotNull String hex(byte[] bytes, boolean upper)
bytes - bytesupper - whether all UPPER CASE hex charpublic static void hex(@NotNull
@NotNull StringBuilder sb,
byte b,
char[] table)
sb - bufferb - bytetable - 0-F tablepublic static int unicode(char c,
byte[] ob)
Turning a char into java's unicode format. eg. `我`(25105)->'我' Note, this method is not very efficient, for more options see StringEscapeUtil, ByteBuffer
c - the charob - byte arrays of length greater than or equal to 6Copyright © 2024. All rights reserved.