类 Bytes
java.lang.Object
cn.valot.common.data.Bytes
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static byte[]append(byte[] src, byte[] ele) byte 数组相加static byte[]appendAll(byte[] src, byte[]... ele) byte 数组相加 - 全部static byte[]appendPrefix(byte[] src, byte prefix) bytes 添加前缀 bytestatic byte[]appendSuffix(byte[] src, byte suffix) bytes 添加后缀 bytestatic byte[]Decode hex string to a byte arraystatic StringencodeHex(byte[] binaryData) Encode a byte array to hex stringstatic Booleaneq(byte[] b1, byte[] b2) 判断两个 byte[] 是否相等static byte[]reverse(byte[] data) 大小端转换static byte[]slice(byte[] data, int start, int end) 截取片段 - 使用方法与 substring 相同
-
构造器详细资料
-
Bytes
public Bytes()
-
-
方法详细资料
-
appendPrefix
public static byte[] appendPrefix(byte[] src, byte prefix) bytes 添加前缀 byte- 参数:
src- byte 数组prefix- 前缀
-
appendSuffix
public static byte[] appendSuffix(byte[] src, byte suffix) bytes 添加后缀 byte- 参数:
src- byte 数组suffix- 后缀
-
append
public static byte[] append(byte[] src, byte[] ele) byte 数组相加- 参数:
src- 原数组ele- 相加的数组- 返回:
- src + ele
-
appendAll
public static byte[] appendAll(byte[] src, byte[]... ele) byte 数组相加 - 全部- 参数:
src- 原数组ele- 相加的数组- 返回:
- src + ele
-
reverse
public static byte[] reverse(byte[] data) 大小端转换 -
encodeHex
Encode a byte array to hex string- 参数:
binaryData- array of byte to encode- 返回:
- return encoded string
-
decodeHex
Decode hex string to a byte array- 参数:
encoded- encoded string- 返回:
- return array of byte to encode
-
eq
判断两个 byte[] 是否相等 -
slice
public static byte[] slice(byte[] data, int start, int end) 截取片段 - 使用方法与 substring 相同- 参数:
data- 数据start- 开始索引end- 结束索引
-