类 Bytes
java.lang.Object
com.weicoder.common.lang.Bytes
- 直接已知子类:
W.B
字节数组操作
- 作者:
- WD
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static byte[]add(byte[]... bs) 字节数组相连static byte[]转换Binary序列化static byte[]copy(byte[] b) 拷贝字节数组static byte[]copy(byte[] b, int len) 拷贝字节数组static byte[]copy(byte[] b, int offset, int len) 拷贝字节数组static boolean是否支持序列化类型static Object根据c类型反序列化static ByteArray把字节数组转换为ByteArraystatic ByteArray把字节数组转换为ByteArraystatic ByteArray把字节数组转换为ByteArraystatic <B> B读取字节数组变成对象static booleantoBoolean(byte[] b) 把字节数组转换成intstatic booleantoBoolean(byte[] b, int offset) 把字节数组转换成intstatic bytetoByte(byte[] b) 把字节数组转换成intstatic bytetoByte(byte[] b, int offset) 把字节数组转换成intstatic byte[]toBytes(boolean b) 转换Collection变成字节数组static byte[]转换Object变成字节数组static byte[]toBytes(char c) 转换char变成字节数组static byte[]toBytes(double d) 转换double变成字节数组static byte[]toBytes(float f) 转换float变成字节数组static byte[]toBytes(int i) 转换int变成字节数组static byte[]toBytes(long l) 转换long变成字节数组static byte[]toBytes(short s) 转换short变成字节数组static byte[]转换Binary序列化static byte[]转换ByteArray变成字节数组static byte[]转换Object变成字节数组static byte[]转换Object变成字节数组static byte[]转换Object变成字节数组static byte[]转换String变成字节数组static byte[]转换String变成字节数组static byte[]toBytes(ByteBuffer buff) 转换ByteBuffer变成字节数组static byte[]对List列表内内容可以进行序列化 注不加头直接按列表顺序序列化static chartoChar(byte[] b) 把字节数组转换成charstatic chartoChar(byte[] b, int offset) 把字节数组转换成charstatic doubletoDouble(byte[] b) 把字节数组转换成doublestatic doubletoDouble(byte[] b, int offset) 把字节数组转换成doublestatic floattoFloat(byte[] b) 把字节数组转换成floatstatic floattoFloat(byte[] b, int offset) 把字节数组转换成floatstatic inttoInt(byte[] b) 把字节数组转换成intstatic inttoInt(byte[] b, int offset) 把字节数组转换成intstatic longtoLong(byte[] b) 把字节数组转换成longstatic longtoLong(byte[] b, boolean high) 把字节数组转换成longstatic longtoLong(byte[] b, int offset) 把字节数组转换成longstatic longtoLong(byte[] b, int offset, boolean high) 把字节数组转换成longstatic shorttoShort(byte[] b) 把字节数组转换成shortstatic shorttoShort(byte[] b, int offset) 把字节数组转换成shortstatic StringtoString(byte[] b) 把字节数组转换成longstatic StringtoString(byte[] b, int offset) 把字节数组转换成字符串static StringtoString(byte[] b, int offset, boolean is) 把字节数组转换成字符串
-
构造器详细资料
-
Bytes
public Bytes()
-
-
方法详细资料
-
isType
是否支持序列化类型- 参数:
c- 类- 返回:
- 是否支持序列化
-
to
根据c类型反序列化- 参数:
b- 要转换的对象c- 要转换的类型o- 偏移量 数组0就可以 定义成数组是为了引用传递- 返回:
- 转换后的对象
-
toBytes
转换Object变成字节数组- 参数:
objs- 对象- 返回:
- 字节数组
-
toBytes
转换Object变成字节数组- 参数:
objs- 对象- 返回:
- 字节数组
-
toBytes
public static byte[] toBytes(boolean b) 转换Collection变成字节数组- 参数:
b- 布尔- 返回:
- 字节数组
-
toBytes
转换Object变成字节数组- 参数:
obj- 对象- 返回:
- 字节数组
-
toBytes
对List列表内内容可以进行序列化 注不加头直接按列表顺序序列化- 参数:
list- 列表- 返回:
- 序列化后
-
toBytes
转换Object变成字节数组- 参数:
obj- 对象- 返回:
- 字节数组
-
toBytes
转换Binary序列化- 参数:
binary- Binary接口- 返回:
- 字节数组
-
binary
转换Binary序列化- 参数:
binary- Binary接口- 返回:
- 字节数组
-
toBytes
转换ByteArray变成字节数组- 参数:
array- ByteArray类型- 返回:
- 字节数组
-
toBytes
转换ByteBuffer变成字节数组- 参数:
buff- ByteBuffer类型- 返回:
- 字节数组
-
toBytes
public static byte[] toBytes(int i) 转换int变成字节数组- 参数:
i- int类型- 返回:
- 字节数组
-
toInt
public static int toInt(byte[] b) 把字节数组转换成int- 参数:
b- 字节数组- 返回:
- int
-
toByte
public static byte toByte(byte[] b) 把字节数组转换成int- 参数:
b- 字节数组- 返回:
- int
-
toByte
public static byte toByte(byte[] b, int offset) 把字节数组转换成int- 参数:
b- 字节数组offset- 偏移- 返回:
- int
-
toBoolean
public static boolean toBoolean(byte[] b) 把字节数组转换成int- 参数:
b- 字节数组- 返回:
- int
-
toBoolean
public static boolean toBoolean(byte[] b, int offset) 把字节数组转换成int- 参数:
b- 字节数组offset- 偏移- 返回:
- int
-
toInt
public static int toInt(byte[] b, int offset) 把字节数组转换成int- 参数:
b- 字节数组offset- 偏移- 返回:
- int
-
toBytes
public static byte[] toBytes(short s) 转换short变成字节数组- 参数:
s- short类型- 返回:
- 字节数组
-
toShort
public static short toShort(byte[] b) 把字节数组转换成short- 参数:
b- 字节数组- 返回:
- short
-
toShort
public static short toShort(byte[] b, int offset) 把字节数组转换成short- 参数:
b- 字节数组offset- 偏移- 返回:
- short
-
toBytes
public static byte[] toBytes(char c) 转换char变成字节数组- 参数:
c- char类型- 返回:
- 字节数组
-
toChar
public static char toChar(byte[] b) 把字节数组转换成char- 参数:
b- 字节数组- 返回:
- char
-
toChar
public static char toChar(byte[] b, int offset) 把字节数组转换成char- 参数:
b- 字节数组offset- 偏移- 返回:
- char
-
toBytes
public static byte[] toBytes(float f) 转换float变成字节数组- 参数:
f- float类型- 返回:
- 字节数组
-
toFloat
public static float toFloat(byte[] b) 把字节数组转换成float- 参数:
b- 字节数组- 返回:
- float
-
toFloat
public static float toFloat(byte[] b, int offset) 把字节数组转换成float- 参数:
b- 字节数组offset- 偏移- 返回:
- float
-
toBytes
public static byte[] toBytes(double d) 转换double变成字节数组- 参数:
d- double类型- 返回:
- 字节数组
-
toDouble
public static double toDouble(byte[] b) 把字节数组转换成double- 参数:
b- 字节数组- 返回:
- double
-
toDouble
public static double toDouble(byte[] b, int offset) 把字节数组转换成double- 参数:
b- 字节数组offset- 偏移- 返回:
- double
-
toBytes
public static byte[] toBytes(long l) 转换long变成字节数组- 参数:
l- long类型- 返回:
- 字节数组
-
toLong
public static long toLong(byte[] b) 把字节数组转换成long- 参数:
b- 字节数组- 返回:
- long
-
toLong
public static long toLong(byte[] b, boolean high) 把字节数组转换成long- 参数:
b- 字节数组high- true 高位在前 false 低位在前- 返回:
- long
-
toLong
public static long toLong(byte[] b, int offset) 把字节数组转换成long- 参数:
b- 字节数组offset- 偏移- 返回:
- long
-
toLong
public static long toLong(byte[] b, int offset, boolean high) 把字节数组转换成long- 参数:
b- 字节数组offset- 偏移high- true 高位在前 false 低位在前- 返回:
- long
-
toBytes
转换String变成字节数组- 参数:
s- String类型- 返回:
- 字节数组
-
toBytes
转换String变成字节数组- 参数:
s- String类型is- 是否加上长度- 返回:
- 字节数组
-
toString
把字节数组转换成long- 参数:
b- 字节数组- 返回:
- long
-
toString
把字节数组转换成字符串- 参数:
b- 字节数组offset- 偏移- 返回:
- 字符串
-
toString
把字节数组转换成字符串- 参数:
b- 字节数组offset- 偏移is- 是否读取长度- 返回:
- 字符串
-
copy
public static byte[] copy(byte[] b) 拷贝字节数组- 参数:
b- 字节数组- 返回:
- 字节数组
-
copy
public static byte[] copy(byte[] b, int len) 拷贝字节数组- 参数:
b- 字节数组len- 长度- 返回:
- 字节数组
-
copy
public static byte[] copy(byte[] b, int offset, int len) 拷贝字节数组- 参数:
b- 字节数组offset- 偏移len- 长度- 返回:
- 字节数组
-
toBean
把字节数组转换为ByteArray- 参数:
array- ByteArray 对象b- 字节数组- 返回:
- ByteArray对象
-
toBean
把字节数组转换为ByteArray- 参数:
array- ByteArray 对象b- 字节数组offset- 偏移- 返回:
- ByteArray对象
-
toBean
把字节数组转换为ByteArray- 参数:
array- ByteArray 对象b- 字节数组offset- 偏移len- 长度- 返回:
- ByteArray对象
-
toBinary
读取字节数组变成对象- 类型参数:
B- 泛型- 参数:
b- 字节数组c- 序列化类- 返回:
- 对象
-
add
public static byte[] add(byte[]... bs) 字节数组相连- 参数:
bs- 字节数组- 返回:
- 相连后的数组
-