Class SinglePacketBuffer

    • Constructor Summary

      Constructors 
      Constructor Description
      SinglePacketBuffer​(java.nio.ByteBuffer buffer)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int limit()  
      void limit​(int newLimit)
      Change the buffer's limit
      byte readByte()
      Reads raw byte from the buffer
      byte readByte​(int index)
      Read byte from the buffer at index.
      void readBytes​(byte[] dst)  
      void readBytes​(byte[] dst, int offset, int length)  
      char readChar()  
      double readDouble()  
      float readFloat()  
      int readInt()
      Reads int from the buffer.
      int readInt​(int index)
      Read int from the buffer at index.
      long readLong()  
      short readShort()
      Reads short from the buffer.
      short readShort​(int index)
      Read short from the buffer at index.
      int remaining()  
      void writeByte​(int index, byte value)
      Write byte to the buffer at index.
      void writeInt​(int index, int value)
      Write int to the buffer at index.
      void writeShort​(int index, short value)
      Write int to the buffer at index.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SinglePacketBuffer

        public SinglePacketBuffer​(java.nio.ByteBuffer buffer)
    • Method Detail

      • readByte

        public byte readByte()
        Description copied from interface: ReadableBuffer
        Reads raw byte from the buffer
        Specified by:
        readByte in interface ReadableBuffer
        Returns:
        byte read
      • readShort

        public short readShort()
        Description copied from interface: ReadableBuffer
        Reads short from the buffer.
        16bit integer (00 00)
        Specified by:
        readShort in interface ReadableBuffer
        Returns:
        short read
      • readInt

        public int readInt()
        Description copied from interface: ReadableBuffer
        Reads int from the buffer.
        32bit integer (00 00 00 00)
        Specified by:
        readInt in interface ReadableBuffer
        Returns:
        int read
      • readBytes

        public void readBytes​(byte[] dst,
                              int offset,
                              int length)
        Specified by:
        readBytes in interface ReadableBuffer
      • readByte

        public byte readByte​(int index)
        Description copied from interface: Buffer
        Read byte from the buffer at index.
        8bit integer (00)
        Specified by:
        readByte in interface Buffer
        Parameters:
        index - index to read from
        Returns:
        the byte value at the index.
      • writeByte

        public void writeByte​(int index,
                              byte value)
        Description copied from interface: Buffer
        Write byte to the buffer at index.
        8bit integer (00)
        Specified by:
        writeByte in interface Buffer
        Parameters:
        index - index to write to
        value - to be written
      • readShort

        public short readShort​(int index)
        Description copied from interface: Buffer
        Read short from the buffer at index.
        16bit integer (00 00)
        Specified by:
        readShort in interface Buffer
        Parameters:
        index - index to read from
        Returns:
        the short value at index.
      • writeShort

        public void writeShort​(int index,
                               short value)
        Description copied from interface: Buffer
        Write int to the buffer at index.
        16bit integer (00 00)
        Specified by:
        writeShort in interface Buffer
        Parameters:
        index - index to write to
        value - to be written
      • limit

        public int limit()
        Specified by:
        limit in interface Buffer
        Returns:
        the buffer's limit
      • limit

        public void limit​(int newLimit)
        Description copied from interface: Buffer
        Change the buffer's limit
        Specified by:
        limit in interface Buffer
        Parameters:
        newLimit - the new limit
      • readInt

        public int readInt​(int index)
        Description copied from interface: Buffer
        Read int from the buffer at index.
        32bit integer (00 00 00 00)
        Specified by:
        readInt in interface Buffer
        Parameters:
        index - index to read from
        Returns:
        the int value at index.
      • writeInt

        public void writeInt​(int index,
                             int value)
        Description copied from interface: Buffer
        Write int to the buffer at index.
        32bit integer (00 00 00 00)
        Specified by:
        writeInt in interface Buffer
        Parameters:
        index - index to write to
        value - to be written