类 BytesUtil
java.lang.Object
com.github.tobato.fastdfs.domain.proto.mapper.BytesUtil
java与C服务端数据交换时byte数组与int,long转换的工具类
- 作者:
- yuqih
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static intbuff2int(byte[] bs, int offset) buff convert to intstatic longbuff2long(byte[] bs, int offset) buff convert to longstatic byte[]long2buff(long n) long convert to buff (big-endian)static byte[]objString2Byte(String value, int max, Charset charset) 将String转换为bytestatic byte[]objString2Byte(String value, Charset charset) 将String转换为byte
-
构造器详细资料
-
BytesUtil
public BytesUtil()
-
-
方法详细资料
-
long2buff
public static byte[] long2buff(long n) long convert to buff (big-endian)- 参数:
n- long number- 返回:
- 8 bytes buff
-
buff2long
public static long buff2long(byte[] bs, int offset) buff convert to long- 参数:
bs- the buffer (big-endian)offset- the start position based 0- 返回:
- long number
-
buff2int
public static int buff2int(byte[] bs, int offset) buff convert to int- 参数:
bs- the buffer (big-endian)offset- the start position based 0- 返回:
- int number
-
objString2Byte
将String转换为byte -
objString2Byte
将String转换为byte- 参数:
value-charset-- 返回:
-