java.lang.Object
com.github.tobato.fastdfs.domain.proto.mapper.BytesUtil

public class BytesUtil extends Object
java与C服务端数据交换时byte数组与int,long转换的工具类
作者:
yuqih
  • 构造器详细资料

    • 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

      public static byte[] objString2Byte(String value, int max, Charset charset)
      将String转换为byte
      返回:
      抛出:
      NoSuchMethodException
      InvocationTargetException
      IllegalAccessException
    • objString2Byte

      public static byte[] objString2Byte(String value, Charset charset)
      将String转换为byte
      参数:
      value -
      charset -
      返回: