public class ByteUtils extends Object
| 构造器和说明 |
|---|
ByteUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
arrayEquals(byte[] array1,
byte[] array2)
比较两个字节数组是否相等
|
static String |
asString(byte[] value)
将字节数组转为字符串
|
static BigInteger |
bytesToBigInteger(byte[] b)
字节数组转BigInteger
|
static double |
bytesToDouble(byte[] arr)
把byte[]转double
|
static int |
bytesToInt(byte[] bytes)
将字节数组转为整型数
|
static short |
bytesToShort(byte[] b)
byte[]转short
|
static String |
bytesToString(byte[] bytearray)
字节数组转字符串
|
static List<String> |
bytesToStrings(List<byte[]> byteList)
字节数组列表转为字符串列表
Byte Array List to String List
|
static long |
byteToLong(byte[] b)
字节数组到long的转换.
|
static byte |
caculateXor(byte[] data) |
static byte[] |
concatenate(byte[]... arrays)
按照传入的顺序拼接数组为一个包含所有数组的大数组
Splices the array into a large array containing all of the arrays in the incoming order.
|
static boolean |
contains(List<byte[]> byteList,
byte[] bytes)
判断字节数组中是否包含某一个字节数组
Determine whether or not a byte array is included in the byte array
|
static byte[] |
copyOf(byte[] in,
int length)
字节数组复制
|
static byte[] |
doubleToBytes(double d)
把double转为byte
|
static byte[] |
intToBytes(int num)
将整型数转为对应的字节数组
|
static boolean |
isEmptyOrNull(byte[] array)
字节数组是否为空
|
static byte[] |
longToBytes(long num)
将长整型数转为对应的字节数组
|
static byte[] |
reverseBytes(byte[] bytes)
字节数组逆序
|
static byte[] |
shortToBytes(short num)
short到字节数组的转换.
|
static byte[] |
subBytes(byte[] input,
int startIndex,
int length)
截取字节数组
|
static byte[] |
toBytes(CharSequence str,
String charsetName)
字符串按指定编码规则转为字节数组
|
static String |
toString(byte[] bytes,
String charsetName)
字节数组按指定编码转为字符串
|
public static final byte[] concatenate(byte[]... arrays)
arrays - 想要拼接的数组集合、A collection of arrays that you want to concatenate.public static final boolean isEmptyOrNull(byte[] array)
array - 校验的字节数组public static boolean arrayEquals(byte[] array1,
byte[] array2)
array1 - 需比较的字节数组array2 - 需比较的字节数组public static byte caculateXor(byte[] data)
public static String asString(byte[] value)
value - 需转换的字节数组public static short bytesToShort(byte[] b)
b - 字节数组public static int bytesToInt(byte[] bytes)
bytes - 需转换的字节数组public static long byteToLong(byte[] b)
b - 字节数组public static BigInteger bytesToBigInteger(byte[] b)
b - 需转换在字节数组public static String bytesToString(byte[] bytearray)
bytearray - 字节数组public static double bytesToDouble(byte[] arr)
public static byte[] shortToBytes(short num)
num - 需转换的整型数public static byte[] intToBytes(int num)
num - 需转换的整型数public static byte[] longToBytes(long num)
num - 需转换的长整型数public static byte[] doubleToBytes(double d)
public static byte[] subBytes(byte[] input,
int startIndex,
int length)
input - 源字节数组startIndex - 开始截取的下标length - 截取的长度public static byte[] reverseBytes(byte[] bytes)
bytes - 源字节数组public static byte[] copyOf(byte[] in,
int length)
in - 源字节数组length - 复制的长度public static String toString(byte[] bytes, String charsetName)
bytes - 字节数组charsetName - 编码规则public static byte[] toBytes(CharSequence str, String charsetName)
str - 字符串charsetName - 编码规则public static boolean contains(List<byte[]> byteList, byte[] bytes)
byteList - bytes - Copyright © 2021. All rights reserved.