Class ArrayPacketBuffer

    • Constructor Detail

      • ArrayPacketBuffer

        public ArrayPacketBuffer​(int size,
                                 ResourcePool resourcePool)
    • Method Detail

      • writeByte

        public void writeByte​(byte value)
        Description copied from class: WritableBuffer
        Write a byte to the buffer.
        8bit integer (00) If the underlying data array can't hold a new byte its size is increased 20%
        Specified by:
        writeByte in class WritableBuffer
        Parameters:
        value - to be written
      • 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
      • writeBytes

        public void writeBytes​(byte[] bytes)
        Description copied from class: WritableBuffer
        Write byte[] to the buffer.
        8bit integer array (00 ...)
        Specified by:
        writeBytes in class WritableBuffer
        Parameters:
        bytes - to be written
      • writeShort

        public void writeShort​(short value)
        Description copied from class: WritableBuffer
        Write short to the buffer.
        16bit integer (00 00)
        Specified by:
        writeShort in class WritableBuffer
        Parameters:
        value - to be written
      • 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
      • writeChar

        public void writeChar​(char value)
        Description copied from class: WritableBuffer
        Write char to the buffer.
        16 bit char
        Specified by:
        writeChar in class WritableBuffer
        Parameters:
        value - the char to be put on data.
      • writeInt

        public void writeInt​(int value)
        Description copied from class: WritableBuffer
        Write int to the buffer.
        32bit integer (00 00 00 00)
        Specified by:
        writeInt in class WritableBuffer
        Parameters:
        value - to be written
      • 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
      • writeFloat

        public void writeFloat​(float value)
        Description copied from class: WritableBuffer
        Write float to the buffer.
        32bit float point number (00 00 00 00)
        Specified by:
        writeFloat in class WritableBuffer
        Parameters:
        value - to be written
      • writeLong

        public void writeLong​(long value)
        Description copied from class: WritableBuffer
        Write long to the buffer.
        64bit integer (00 00 00 00 00 00 00 00)
        Specified by:
        writeLong in class WritableBuffer
        Parameters:
        value - to be written
      • writeDouble

        public void writeDouble​(double value)
        Description copied from class: WritableBuffer
        Write double to the buffer.
        64bit double precision float (00 00 00 00 00 00 00 00)
        Specified by:
        writeDouble in class WritableBuffer
        Parameters:
        value - to be written
      • readByte

        public byte readByte()
        Description copied from interface: ReadableBuffer
        Reads raw byte from the buffer
        Specified by:
        readByte in interface ReadableBuffer
        Returns:
        byte read
      • 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.
      • 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
      • 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.
      • 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
      • 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.
      • 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