类 Bytes

java.lang.Object
cn.valot.common.data.Bytes

public class Bytes extends Object
  • 构造器概要

    构造器
    构造器
    说明
     
  • 方法概要

    修饰符和类型
    方法
    说明
    static byte[]
    append(byte[] src, byte[] ele)
    byte 数组相加
    static byte[]
    appendAll(byte[] src, byte[]... ele)
    byte 数组相加 - 全部
    static byte[]
    appendPrefix(byte[] src, byte prefix)
    bytes 添加前缀 byte
    static byte[]
    appendSuffix(byte[] src, byte suffix)
    bytes 添加后缀 byte
    static byte[]
    decodeHex(String encoded)
    Decode hex string to a byte array
    static String
    encodeHex(byte[] binaryData)
    Encode a byte array to hex string
    static Boolean
    eq(byte[] b1, byte[] b2)
    判断两个 byte[] 是否相等
    static byte[]
    reverse(byte[] data)
    大小端转换
    static byte[]
    slice(byte[] data, int start, int end)
    截取片段 - 使用方法与 substring 相同

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 构造器详细资料

    • 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

      public static String encodeHex(byte[] binaryData)
      Encode a byte array to hex string
      参数:
      binaryData - array of byte to encode
      返回:
      return encoded string
    • decodeHex

      public static byte[] decodeHex(String encoded)
      Decode hex string to a byte array
      参数:
      encoded - encoded string
      返回:
      return array of byte to encode
    • eq

      public static Boolean eq(byte[] b1, byte[] b2)
      判断两个 byte[] 是否相等
    • slice

      public static byte[] slice(byte[] data, int start, int end)
      截取片段 - 使用方法与 substring 相同
      参数:
      data - 数据
      start - 开始索引
      end - 结束索引