类 Buffers


  • public class Buffers
    extends java.lang.Object
    Utils for buffers
    • 构造器概要

      构造器 
      构造器 说明
      Buffers()  
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static void advance​(java.nio.Buffer buffer, int step)
      Increase buffer position to new position, by step. if step is less than zero, the position is moved back.
      static int ensureGetUInt​(java.nio.ByteBuffer buffer)
      Get four bytes, as unsigned long value from buffer.
      static long ensureGetULong​(java.nio.ByteBuffer buffer)
      Get eight bytes, as unsigned long value from buffer.
      static short getUByte​(java.nio.ByteBuffer buffer)
      Get a byte, as unsigned byte from buffer.
      static long getUInt​(java.nio.ByteBuffer buffer)
      Get four bytes, as unsigned int value from buffer.
      static int getUShort​(java.nio.ByteBuffer buffer)
      Get two bytes, as unsigned short value from buffer.
      static java.nio.ByteBuffer slice​(java.nio.ByteBuffer buffer)
      This method return a subsequent buffer as ByteBuffer.slice(), with additional set the byte order of sliced new ByteBuffer to the same of original buffer.
      • 从类继承的方法 java.lang.Object

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

      • Buffers

        public Buffers()
    • 方法详细资料

      • advance

        public static void advance​(java.nio.Buffer buffer,
                                   int step)
        Increase buffer position to new position, by step. if step is less than zero, the position is moved back.
        参数:
        buffer - the buffer
        step - the step to increase the position
        抛出:
        java.nio.BufferOverflowException - if new position is not a valid position.
      • slice

        public static java.nio.ByteBuffer slice​(java.nio.ByteBuffer buffer)
        This method return a subsequent buffer as ByteBuffer.slice(), with additional set the byte order of sliced new ByteBuffer to the same of original buffer.
        参数:
        buffer - the origin buffer
        返回:
        the new buffer hold the remain data of original buffer
      • getUByte

        public static short getUByte​(java.nio.ByteBuffer buffer)
        Get a byte, as unsigned byte from buffer.
        返回:
        a short value hold the unsigned byte.
      • getUShort

        public static int getUShort​(java.nio.ByteBuffer buffer)
        Get two bytes, as unsigned short value from buffer.
        返回:
        a int value hold the unsigned short value.
      • getUInt

        public static long getUInt​(java.nio.ByteBuffer buffer)
        Get four bytes, as unsigned int value from buffer.
        返回:
        a long value hold the unsigned int value.
      • ensureGetUInt

        public static int ensureGetUInt​(java.nio.ByteBuffer buffer)
        Get four bytes, as unsigned long value from buffer. If the value can not hold in unsigned int, a exception thrown.
        返回:
        a int value hold the unsigned int value.
        抛出:
        java.lang.ArithmeticException - if int can not hold this unsigned int value
      • ensureGetULong

        public static long ensureGetULong​(java.nio.ByteBuffer buffer)
        Get eight bytes, as unsigned long value from buffer. If the value can not hold in unsigned long, a exception thrown.
        返回:
        a long value hold the unsigned long value.
        抛出:
        java.lang.ArithmeticException - if long can not hold this unsigned long value