Class ByteUtil

java.lang.Object
org.qiunet.utils.data.ByteUtil

public class ByteUtil extends Object
Author:
qiunet 2020-11-17 12:48
  • Constructor Details

    • ByteUtil

      public ByteUtil()
  • Method Details

    • readU16bit

      public static int readU16bit(byte[] code, int index)
      Reads an unsigned 16bit integer at the index.
    • readS16bit

      public static int readS16bit(byte[] code, int index)
      Reads a signed 16bit integer at the index.
    • read32bit

      public static int read32bit(byte[] code, int index)
      Reads a 32bit integer at the index.
    • short2Bytes

      public static byte[] short2Bytes(int value)
      short 转换为byte数组
      Parameters:
      value -
      Returns:
    • int2Bytes

      public static byte[] int2Bytes(int value)
      int 转换为byte数组
      Parameters:
      value -
      Returns:
    • long2Bytes

      public static byte[] long2Bytes(long value)
      long 转换为byte数组
      Parameters:
      value -
      Returns:
    • readBytebuffer

      public static byte[] readBytebuffer(ByteBuffer buffer)
      读取ByteBuffer的内容. 返回array
      Parameters:
      buffer -
      Returns:
    • readBytebuffer

      public static byte[] readBytebuffer(ByteBuffer buffer, int index, int length)
      读取ByteBuffer的内容. 返回array
      Parameters:
      buffer -
      Returns: