public final class Bytes extends Object
| 构造器和说明 |
|---|
Bytes() |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
concat(byte[] first,
byte[]... rest)
merge byte arrays
|
static byte[] |
hexDecode(String hex)
decode the hex string to byte array
|
static String |
hexEncode(byte[] bytes) |
static String |
hexEncode(byte[] bytes,
boolean lowercase)
encode the byte array the hex string
|
static String |
hexEncode(byte b,
boolean lowercase) |
static void |
hexEncode(char[] charArray,
int i,
byte b) |
static void |
put(int val,
byte[] bytes,
int offset)
Puts int number to byte array
|
static void |
put(long val,
byte[] bytes,
int offset) |
static byte[] |
remaining(ByteBuffer buf) |
static BigDecimal |
toBigDecimal(byte[] bytes)
Converts a byte array to a BigDecimal
|
static BigDecimal |
toBigDecimal(byte[] bytes,
int offset,
int length)
Converts a byte array to a BigDecimal value
|
static BigInteger |
toBigInteger(byte[] bytes)
Converts byte array to positive BigInteger
|
static String |
toBinary(byte... array)
convert the byte array to binary string
byte:
-1: 11111111
0: 00000000
127: 01111111
-128: 10000000
|
static byte[] |
toBytes(BigDecimal val)
Convert a BigDecimal value to a byte array
|
static byte[] |
toBytes(char value) |
static byte[] |
toBytes(char[] chars)
Converts char array to byte array
|
static byte[] |
toBytes(char[] chars,
Charset charset)
Converts char array to byte array
|
static byte[] |
toBytes(int value) |
static byte[] |
toBytes(long value)
convert long value to byte array
|
static char |
toChar(byte[] bytes) |
static char |
toChar(byte[] bytes,
int fromIdx) |
static char[] |
toCharArray(byte[] bytes)
Converts byte array to char array
|
static char[] |
toCharArray(byte[] bytes,
Charset charset)
Converts byte array to char array
|
static String |
toHex(long value) |
static String |
toHex(long value,
boolean lowercase) |
static int |
toInt(byte[] bytes) |
static int |
toInt(byte[] bytes,
int fromIdx) |
static long |
toLong(byte[] bytes)
convert byte array to long number
|
static long |
toLong(byte[] bytes,
int fromIdx)
convert byte array to long number
|
public static void hexEncode(char[] charArray,
int i,
byte b)
public static String hexEncode(byte b, boolean lowercase)
public static String hexEncode(byte[] bytes)
public static String hexEncode(byte[] bytes, boolean lowercase)
bytes - the byte arraylowercase - the booleanpublic static byte[] hexDecode(String hex)
hex - public static String toBinary(byte... array)
array - the byte arraypublic static char[] toCharArray(byte[] bytes)
bytes - the byte arraypublic static char[] toCharArray(byte[] bytes,
Charset charset)
bytes - the byte arraycharset - the charsetpublic static byte[] toBytes(char[] chars)
chars - the char arraypublic static byte[] toBytes(char[] chars,
Charset charset)
chars - the char arraycharset - the charsetpublic static byte[] toBytes(char value)
public static char toChar(byte[] bytes)
public static char toChar(byte[] bytes,
int fromIdx)
public static byte[] toBytes(int value)
public static int toInt(byte[] bytes)
public static int toInt(byte[] bytes,
int fromIdx)
public static byte[] toBytes(long value)
value - the long numberpublic static String toHex(long value)
public static String toHex(long value, boolean lowercase)
public static long toLong(byte[] bytes,
int fromIdx)
bytes - the byte arrayfromIdx - the byte array offsetpublic static long toLong(byte[] bytes)
bytes - the byte arraypublic static byte[] toBytes(BigDecimal val)
val - the BigDecimal valuepublic static void put(int val,
byte[] bytes,
int offset)
val - the int valuebytes - the byte arrayoffset - the byte array start offsetpublic static void put(long val,
byte[] bytes,
int offset)
public static BigDecimal toBigDecimal(byte[] bytes)
bytes - the byte arraypublic static BigDecimal toBigDecimal(byte[] bytes, int offset, int length)
bytes - the byte arrayoffset - the offsetlength - the lengthpublic static BigInteger toBigInteger(byte[] bytes)
bytes - the byte arraypublic static byte[] concat(byte[] first,
byte[]... rest)
first - first byte array of argsrest - others byte arraypublic static byte[] remaining(ByteBuffer buf)
Copyright © 2023. All rights reserved.