Interface ChannelBuf


  • public interface ChannelBuf
    A ChannelStream allows for plugins and the server to read and write Java primitive data and some higher level data to DataView if necessary.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      byte[] array()
      Gets the backing byte array of this stream.
      InputStream asInputStream()
      Gets this ChannelBuf as a InputStream.
      OutputStream asOutputStream()
      Gets this ChannelBuf as a OutputStream.
      int available()
      Gets the number of bytes available between the reader and the writer.
      int capacity()
      Gets the number of bytes this buffer can contain.
      ChannelBuf clear()
      Sets the readerIndex and writerIndex of this buffer to 0.
      ChannelBuf ensureWritable​(int minWritableBytes)
      Makes sure the number of the writable bytes is equal to or greater than the specified value.
      boolean getBoolean​(int index)
      Gets a boolean at the specified absolute index in this buffer.
      byte getByte​(int index)
      Gets a byte at the specified absolute index in this buffer.
      byte[] getByteArray​(int index)
      Gets a byte array at the specified absolute index in this buffer.
      byte[] getByteArray​(int index, int limit)
      Gets a byte array at the specified absolute index in this buffer.
      char getChar​(int index)
      Gets a character at the specified absolute index from this buffer.
      DataView getDataView​(int index)
      Gets a DataView at the specified absolute index in this buffer.
      double getDouble​(int index)
      Gets a double at the specified absolute index in this buffer.
      double getDoubleLE​(int index)
      Gets a double at the specified absolute index from this buffer in little endian byte order.
      float getFloat​(int index)
      Gets a float at the specified absolute index from this buffer.
      float getFloatLE​(int index)
      Gets a float at the specified absolute index from this buffer in little endian byte order.
      int getInt​(int index)
      Gets an integer at the specified absolute index from this buffer.
      int getIntLE​(int index)
      Gets an integer at the specified absolute index from this buffer in little endian byte order.
      long getLong​(int index)
      Gets a long integer at the specified absolute index from this buffer.
      long getLongLE​(int index)
      Gets a long integer at the specified absolute index from this buffer in little endian byte order.
      short getShort​(int index)
      Gets a short integer at the specified absolute index from this buffer.
      short getShortLE​(int index)
      Gets a short integer at the specified absolute index from this buffer in little endian byte order.
      String getString​(int index)
      Gets a string at the specified absolute index in this buffer.
      UUID getUniqueId​(int index)
      Gets a UUID at the specified absolute index in this buffer.
      String getUTF​(int index)
      Gets a string at the specified absolute index in this buffer.
      int getVarInt​(int index)
      Gets a varint at the specified absolute index in this buffer.
      long getVarLong​(int index)
      Gets a varlong at the specified absolute index in this buffer.
      boolean hasArray()
      Returns true if and only if this buffer has a backing byte array.
      boolean readBoolean()
      Gets a boolean at the current readerIndex and increases the readerIndex by 1 in this buffer.
      byte readByte()
      Gets a byte at the current readerIndex and increases the readerIndex by 1 in this buffer.
      byte[] readByteArray()
      Gets a byte array at the current readerIndex and increases the readerIndex by the length of the array and the length of the array size.
      byte[] readByteArray​(int limit)
      Gets a byte array at the current readerIndex and increases the readerIndex by the length of the array and the length of the array size.
      byte[] readBytes​(int length)
      Gets a byte array at the current readerIndex and increases the readerIndex by the length of the array.
      byte[] readBytes​(int index, int length)
      Gets a byte array at the specified absolute index in this buffer.
      char readChar()
      Gets a character at the current readerIndex from this buffer and increases the readerIndex by 2.
      DataView readDataView()
      Gets a DataView at the current readerIndex and increases the readerIndex according to the length of the data view in this buffer.
      double readDouble()
      Gets a double at the current readerIndex and increases the readerIndex by 8 in this buffer.
      double readDoubleLE()
      Gets a double at the current readerIndex from this buffer in little endian byte order and increases the readerIndex by 8.
      int readerIndex()
      Gets the readerIndex of this buffer.
      ChannelBuf readerIndex​(int index)
      Sets the readerIndex of this buffer.
      float readFloat()
      Gets a float at the current readerIndex of this buffer and increases the readerIndex by 4.
      float readFloatLE()
      Gets a float at the current readerIndex of this buffer in little endian byte order and increases the readerIndex by 4.
      int readInt()
      Gets an integer at the current readerIndex from this buffer and increases the readerIndex by 4.
      int readIntLE()
      Gets an integer at the current readerIndex in little endian byte order from this buffer and increases the readerIndex by 4.
      long readLong()
      Gets a long integer at the current readerIndex from this buffer and increases the readerIndex by 8.
      long readLongLE()
      Gets a long integer at the current readerIndex from this buffer in little endian byte order and increases the readerIndex by 8.
      short readShort()
      Gets a short integer at the current readerIndex from this buffer and increases the readerIndex by 2.
      short readShortLE()
      Gets a short integer at the current readerIndex from this buffer in little endian byte order and increases the readerIndex by 2.
      ChannelBuf readSlice​(int length)
      Returns a slice of this buffer's sub-region at the current readerIndex.
      String readString()
      Gets a string at the current readerIndex and increases the readerIndex by the length of a varint followed by the utf-8 bytes of the string.
      UUID readUniqueId()
      Gets a UUID at the current readerIndex and increases the readerIndex by 16 in this buffer.
      String readUTF()
      Gets a string at the current readerIndex and increases the readerIndex by the length of a varint followed by the utf-8 bytes of the string.
      int readVarInt()
      Gets a varint at the current readerIndex and increases the readerIndex by the number of bytes read.
      long readVarLong()
      Gets a varlong at the current readerIndex and increases the readerIndex by the number of bytes read.
      ChannelBuf setBoolean​(int index, boolean data)
      Sets the boolean at the specified absolute index in this buffer.
      ChannelBuf setByte​(int index, byte data)
      Sets the byte at the specified absolute index in this buffer.
      ChannelBuf setByteArray​(int index, byte[] data)
      Sets the specified byte array at the specified absolute index in this buffer.
      ChannelBuf setByteArray​(int index, byte[] data, int start, int length)
      Sets the specified byte array at the specified absolute index in this buffer.
      ChannelBuf setBytes​(int index, byte[] data)
      Sets the specified byte array at the specified absolute index in this buffer.
      ChannelBuf setBytes​(int index, byte[] data, int start, int length)
      Sets the specified byte array at the specified absolute index in this buffer.
      ChannelBuf setChar​(int index, char data)
      Sets the char at the specified absolute index of this buffer.
      ChannelBuf setDataView​(int index, DataView data)
      Sets the DataView at the specified absolute index in this buffer.
      ChannelBuf setDouble​(int index, double data)
      Sets the double at the specified absolute index of this buffer.
      ChannelBuf setDoubleLE​(int index, double data)
      Sets the double at the specified absolute index of this buffer in little endian byte order.
      ChannelBuf setFloat​(int index, float data)
      Sets the float at the specified absolute index of this buffer.
      ChannelBuf setFloatLE​(int index, float data)
      Sets the float at the specified absolute index of this buffer in little endian byte order.
      ChannelBuf setIndex​(int readIndex, int writeIndex)
      Sets both the reader and writer indices.
      ChannelBuf setInt​(int index, int data)
      Sets the integer at the specified absolute index of this buffer.
      ChannelBuf setIntLE​(int index, int data)
      Sets the integer at the specified absolute index of this buffer in little endian byte order.
      ChannelBuf setLong​(int index, long data)
      Sets the long integer at the specified absolute index of this buffer.
      ChannelBuf setLongLE​(int index, long data)
      Sets the long integer at the specified absolute index of this buffer in little endian byte order.
      ChannelBuf setShort​(int index, short data)
      Sets the short at the specified absolute index of this buffer.
      ChannelBuf setShortLE​(int index, short data)
      Sets the short at the specified absolute index of this buffer in little endian byte order.
      ChannelBuf setString​(int index, String data)
      Sets the string at the specified absolute index in this buffer.
      ChannelBuf setUniqueId​(int index, UUID data)
      Sets the UUID at the specified absolute index in this buffer.
      ChannelBuf setUTF​(int index, String data)
      Sets the string at the specified absolute index in this buffer.
      ChannelBuf setVarInt​(int index, int data)
      Sets the specified varint at the specified absolute index in this buffer.
      ChannelBuf setVarLong​(int index, long value)
      Sets the specified varlong at the specified absolute index in this buffer.
      ChannelBuf slice()
      Returns a slice of this buffer's readable bytes.
      ChannelBuf slice​(int index, int length)
      Returns a slice of this buffer's sub-region.
      ChannelBuf writeBoolean​(boolean data)
      Sets the specified boolean at the current writerIndex and increases the writerIndex by 1 in this buffer.
      ChannelBuf writeByte​(byte data)
      Sets the specified byte at the current writerIndex and increases the writerIndex by 1 in this buffer.
      ChannelBuf writeByteArray​(byte[] data)
      Sets the specified byte array at the current writerIndex and increases the writerIndex by the number of bytes and the size of the length as a varint.
      ChannelBuf writeByteArray​(byte[] data, int start, int length)
      Sets the specified byte array at the current writerIndex and increases the writerIndex by the length specified and the size of the length as a varint.
      ChannelBuf writeBytes​(byte[] data)
      Sets the specified byte array at the current writerIndex and increases the writerIndex by the number of bytes.
      ChannelBuf writeBytes​(byte[] data, int start, int length)
      Sets the specified byte array at the current writerIndex and increases the writerIndex by the length specified.
      ChannelBuf writeChar​(char data)
      Sets the specified character at the current writerIndex of this buffer and increases the writerIndex by 2.
      ChannelBuf writeDataView​(DataView data)
      Sets the specified DataView at the current writerIndex and increases the writerIndex according to the length of the data view in this buffer.
      ChannelBuf writeDouble​(double data)
      Sets the specified double at the current writerIndex of this buffer and increases the writerIndex by 8.
      ChannelBuf writeDoubleLE​(double data)
      Sets the specified double at the current writerIndex of this buffer in little endian byte order and increases the writerIndex by 8.
      ChannelBuf writeFloat​(float data)
      Sets the specified float at the current writerIndex of this buffer and increases the writerIndex by 4.
      ChannelBuf writeFloatLE​(float data)
      Sets the specified float at the current writerIndex of this buffer in little endian byte order and increases the writerIndex by 4.
      ChannelBuf writeInt​(int data)
      Sets the specified integer at the current writerIndex of this buffer and increases the writerIndex by 4.
      ChannelBuf writeIntLE​(int data)
      Sets the specified integer at the current writerIndex of this buffer in little endian byte order and increases the writerIndex by 4.
      ChannelBuf writeLong​(long data)
      Sets the specified long integer at the current writerIndex of this buffer and increases the writerIndex by 8.
      ChannelBuf writeLongLE​(long data)
      Sets the specified long integer at the current writerIndex of this buffer in little endian byte order and increases the writerIndex by 8.
      int writerIndex()
      Gets the writerIndex of this buffer.
      ChannelBuf writerIndex​(int index)
      Sets the writerIndex of this buffer.
      ChannelBuf writeShort​(short data)
      Sets the specified short integer at the current writerIndex of this buffer and increases the writerIndex by 2.
      ChannelBuf writeShortLE​(short data)
      Sets the specified short integer at the current writerIndex in little endian byte order and increases the writerIndex by 2 in this buffer.
      ChannelBuf writeString​(String data)
      Sets the specified string at the current writerIndex and increases the writerIndex by the length of the string.
      ChannelBuf writeUniqueId​(UUID data)
      Sets the specified UUID at the current writerIndex and increases the writerIndex by 16 in this buffer.
      ChannelBuf writeUTF​(String data)
      Sets the specified string at the current writerIndex and increases the writerIndex by the length of the string.
      ChannelBuf writeVarInt​(int data)
      Sets the specified varint at the current writerIndex and increases the writerIndex by the number of bytes written.
      ChannelBuf writeVarLong​(long value)
      Sets the specified varlong at the current writerIndex and increases the writerIndex by the number of bytes written.
    • Method Detail

      • capacity

        int capacity()
        Gets the number of bytes this buffer can contain.
        Returns:
        The number of bytes this buffer can contain
      • ensureWritable

        ChannelBuf ensureWritable​(int minWritableBytes)
        Makes sure the number of the writable bytes is equal to or greater than the specified value.
        Parameters:
        minWritableBytes - The minimum writable bytes
        Returns:
        This stream for chaining
      • available

        int available()
        Gets the number of bytes available between the reader and the writer.
        Returns:
        The number of available bytes
      • readerIndex

        int readerIndex()
        Gets the readerIndex of this buffer.
        Returns:
        The current read index
      • readerIndex

        ChannelBuf readerIndex​(int index)
        Sets the readerIndex of this buffer.
        Parameters:
        index - The new index
        Returns:
        This stream for chaining
      • writerIndex

        int writerIndex()
        Gets the writerIndex of this buffer.
        Returns:
        The current write index
      • writerIndex

        ChannelBuf writerIndex​(int index)
        Sets the writerIndex of this buffer.
        Parameters:
        index - The new index
        Returns:
        This stream for chaining
      • setIndex

        ChannelBuf setIndex​(int readIndex,
                            int writeIndex)
        Sets both the reader and writer indices.
        Parameters:
        readIndex - The reader index
        writeIndex - The writer index
        Returns:
        This stream for chaining
      • clear

        ChannelBuf clear()
        Sets the readerIndex and writerIndex of this buffer to 0. This method is identical to setIndex(int, int).
        Returns:
        This stream for chaining
      • slice

        ChannelBuf slice()
        Returns a slice of this buffer's readable bytes. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks. This method is identical to buf.slice(buf.readerIndex(), buf.readableBytes()). This method does not modify readerIndex or writerIndex of this buffer.
        Returns:
        The sliced stream
      • slice

        ChannelBuf slice​(int index,
                         int length)
        Returns a slice of this buffer's sub-region. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks. This method does not modify readerIndex or writerIndex of this buffer.
        Parameters:
        index - The starter index
        length - The ending index
        Returns:
        The sliced stream
      • readSlice

        ChannelBuf readSlice​(int length)
        Returns a slice of this buffer's sub-region at the current readerIndex. The readerIndex is increased by the given length.

        Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks.

        Parameters:
        length - The amount of bytes in the slice
        Returns:
        The sliced stream
      • hasArray

        boolean hasArray()
        Returns true if and only if this buffer has a backing byte array.

        If this method returns true, you can safely call array().

        Returns:
        true if this buffer has a backing byte array
      • writeBoolean

        ChannelBuf writeBoolean​(boolean data)
        Sets the specified boolean at the current writerIndex and increases the writerIndex by 1 in this buffer.
        Parameters:
        data - The boolean data
        Returns:
        This stream for chaining
      • setBoolean

        ChannelBuf setBoolean​(int index,
                              boolean data)
        Sets the boolean at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
        Parameters:
        index - The index
        data - The boolean data
        Returns:
        This stream for chaining
      • readBoolean

        boolean readBoolean()
        Gets a boolean at the current readerIndex and increases the readerIndex by 1 in this buffer.
        Returns:
        The boolean
      • getBoolean

        boolean getBoolean​(int index)
        Gets a boolean at the specified absolute index in this buffer.
        Parameters:
        index - The index
        Returns:
        The boolean
      • writeByte

        ChannelBuf writeByte​(byte data)
        Sets the specified byte at the current writerIndex and increases the writerIndex by 1 in this buffer.
        Parameters:
        data - The byte data
        Returns:
        This stream for chaining
      • setByte

        ChannelBuf setByte​(int index,
                           byte data)
        Sets the byte at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
        Parameters:
        index - The index
        data - The byte data
        Returns:
        This stream for chaining
      • readByte

        byte readByte()
        Gets a byte at the current readerIndex and increases the readerIndex by 1 in this buffer.
        Returns:
        The byte
      • getByte

        byte getByte​(int index)
        Gets a byte at the specified absolute index in this buffer.
        Parameters:
        index - The index
        Returns:
        The byte
      • writeByteArray

        ChannelBuf writeByteArray​(byte[] data)
        Sets the specified byte array at the current writerIndex and increases the writerIndex by the number of bytes and the size of the length as a varint.

        The length of the array is written preceding the data as a varint.

        Parameters:
        data - The byte array data
        Returns:
        This stream for chaining
      • writeByteArray

        ChannelBuf writeByteArray​(byte[] data,
                                  int start,
                                  int length)
        Sets the specified byte array at the current writerIndex and increases the writerIndex by the length specified and the size of the length as a varint.

        The length of the array is written preceding the data as a varint.

        Parameters:
        data - The byte array data
        start - The starting index of the source array to start reading from
        length - The length of bytes to read from the source array
        Returns:
        This stream for chaining
      • setByteArray

        ChannelBuf setByteArray​(int index,
                                byte[] data)
        Sets the specified byte array at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.

        The length of the array is written preceding the data as a varint.

        Parameters:
        index - The index
        data - The byte array data
        Returns:
        This stream for chaining
      • setByteArray

        ChannelBuf setByteArray​(int index,
                                byte[] data,
                                int start,
                                int length)
        Sets the specified byte array at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.

        The length of the array is written preceding the data as a varint.

        Parameters:
        index - The index
        data - The byte array data
        start - The starting index of the source array to start reading from
        length - The length of bytes to read from the source array
        Returns:
        This stream for chaining
      • readByteArray

        byte[] readByteArray()
        Gets a byte array at the current readerIndex and increases the readerIndex by the length of the array and the length of the array size.

        The length of the array is expected to be preceding the array as a varint.

        Returns:
        The byte array
      • readByteArray

        byte[] readByteArray​(int limit)
        Gets a byte array at the current readerIndex and increases the readerIndex by the length of the array and the length of the array size.

        The length of the array is expected to be preceding the array as a varint.

        Parameters:
        limit - The limit of the length of the array
        Returns:
        The byte array
      • getByteArray

        byte[] getByteArray​(int index)
        Gets a byte array at the specified absolute index in this buffer.

        The length of the array is expected to be preceding the array as a varint.

        Parameters:
        index - The index to read the byte array at
        Returns:
        The byte array
      • getByteArray

        byte[] getByteArray​(int index,
                            int limit)
        Gets a byte array at the specified absolute index in this buffer.

        The length of the array is expected to be preceding the array as a varint.

        Parameters:
        index - The index to read the byte array at
        limit - The limit of the length of the array
        Returns:
        The byte array
      • writeBytes

        ChannelBuf writeBytes​(byte[] data)
        Sets the specified byte array at the current writerIndex and increases the writerIndex by the number of bytes.
        Parameters:
        data - The byte array data
        Returns:
        This stream for chaining
      • writeBytes

        ChannelBuf writeBytes​(byte[] data,
                              int start,
                              int length)
        Sets the specified byte array at the current writerIndex and increases the writerIndex by the length specified.
        Parameters:
        data - The byte array data
        start - The starting index of the source array to start reading from
        length - The length of bytes to read from the source array
        Returns:
        This stream for chaining
      • setBytes

        ChannelBuf setBytes​(int index,
                            byte[] data)
        Sets the specified byte array at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
        Parameters:
        index - The index
        data - The byte array data
        Returns:
        This stream for chaining
      • setBytes

        ChannelBuf setBytes​(int index,
                            byte[] data,
                            int start,
                            int length)
        Sets the specified byte array at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
        Parameters:
        index - The index
        data - The byte array data
        start - The starting index of the source array to start reading from
        length - The length of bytes to read from the source array
        Returns:
        This stream for chaining
      • readBytes

        byte[] readBytes​(int length)
        Gets a byte array at the current readerIndex and increases the readerIndex by the length of the array.
        Parameters:
        length - The length of the byte array to read from
        Returns:
        The byte array
      • readBytes

        byte[] readBytes​(int index,
                         int length)
        Gets a byte array at the specified absolute index in this buffer.
        Parameters:
        index - The index of this channel buff to read from
        length - The length of the byte array
        Returns:
        The byte array
      • writeShort

        ChannelBuf writeShort​(short data)
        Sets the specified short integer at the current writerIndex of this buffer and increases the writerIndex by 2.
        Parameters:
        data - The short data
        Returns:
        This stream for chaining
      • writeShortLE

        ChannelBuf writeShortLE​(short data)
        Sets the specified short integer at the current writerIndex in little endian byte order and increases the writerIndex by 2 in this buffer.
        Parameters:
        data - The short data
        Returns:
        This stream for chaining
      • setShort

        ChannelBuf setShort​(int index,
                            short data)
        Sets the short at the specified absolute index of this buffer. This method does not modify readerIndex or writerIndex.
        Parameters:
        index - The index
        data - The short data
        Returns:
        This stream for chaining
      • setShortLE

        ChannelBuf setShortLE​(int index,
                              short data)
        Sets the short at the specified absolute index of this buffer in little endian byte order. This method does not modify readerIndex or writerIndex.
        Parameters:
        index - The index
        data - The short data
        Returns:
        This stream for chaining
      • readShort

        short readShort()
        Gets a short integer at the current readerIndex from this buffer and increases the readerIndex by 2.
        Returns:
        The short integer
      • readShortLE

        short readShortLE()
        Gets a short integer at the current readerIndex from this buffer in little endian byte order and increases the readerIndex by 2.
        Returns:
        The short integer
      • getShort

        short getShort​(int index)
        Gets a short integer at the specified absolute index from this buffer.
        Parameters:
        index - The index
        Returns:
        The short integer
      • getShortLE

        short getShortLE​(int index)
        Gets a short integer at the specified absolute index from this buffer in little endian byte order.
        Parameters:
        index - The index
        Returns:
        The short integer
      • writeChar

        ChannelBuf writeChar​(char data)
        Sets the specified character at the current writerIndex of this buffer and increases the writerIndex by 2.
        Parameters:
        data - The char data
        Returns:
        This stream for chaining
      • setChar

        ChannelBuf setChar​(int index,
                           char data)
        Sets the char at the specified absolute index of this buffer. This method does not modify readerIndex or writerIndex.
        Parameters:
        index - The index
        data - The char data
        Returns:
        This stream for chaining
      • readChar

        char readChar()
        Gets a character at the current readerIndex from this buffer and increases the readerIndex by 2.
        Returns:
        The character
      • getChar

        char getChar​(int index)
        Gets a character at the specified absolute index from this buffer.
        Parameters:
        index - The index
        Returns:
        The character
      • writeInt

        ChannelBuf writeInt​(int data)
        Sets the specified integer at the current writerIndex of this buffer and increases the writerIndex by 4.
        Parameters:
        data - The integer data
        Returns:
        This stream for chaining
      • writeIntLE

        ChannelBuf writeIntLE​(int data)
        Sets the specified integer at the current writerIndex of this buffer in little endian byte order and increases the writerIndex by 4.
        Parameters:
        data - The integer data
        Returns:
        This stream for chaining
      • setInt

        ChannelBuf setInt​(int index,
                          int data)
        Sets the integer at the specified absolute index of this buffer. This method does not modify readerIndex or writerIndex.
        Parameters:
        index - The index
        data - The integer data
        Returns:
        This stream for chaining
      • setIntLE

        ChannelBuf setIntLE​(int index,
                            int data)
        Sets the integer at the specified absolute index of this buffer in little endian byte order. This method does not modify readerIndex or writerIndex.
        Parameters:
        index - The index
        data - The integer data
        Returns:
        This stream for chaining
      • readInt

        int readInt()
        Gets an integer at the current readerIndex from this buffer and increases the readerIndex by 4.
        Returns:
        The integer
      • readIntLE

        int readIntLE()
        Gets an integer at the current readerIndex in little endian byte order from this buffer and increases the readerIndex by 4.
        Returns:
        The integer
      • getInt

        int getInt​(int index)
        Gets an integer at the specified absolute index from this buffer.
        Parameters:
        index - The index
        Returns:
        The integer
      • getIntLE

        int getIntLE​(int index)
        Gets an integer at the specified absolute index from this buffer in little endian byte order.
        Parameters:
        index - The index
        Returns:
        The integer
      • writeLong

        ChannelBuf writeLong​(long data)
        Sets the specified long integer at the current writerIndex of this buffer and increases the writerIndex by 8.
        Parameters:
        data - The long data
        Returns:
        This stream for chaining
      • writeLongLE

        ChannelBuf writeLongLE​(long data)
        Sets the specified long integer at the current writerIndex of this buffer in little endian byte order and increases the writerIndex by 8.
        Parameters:
        data - The long data
        Returns:
        This stream for chaining
      • setLong

        ChannelBuf setLong​(int index,
                           long data)
        Sets the long integer at the specified absolute index of this buffer. This method does not modify readerIndex or writerIndex.
        Parameters:
        index - The index
        data - The long data
        Returns:
        This stream for chaining
      • setLongLE

        ChannelBuf setLongLE​(int index,
                             long data)
        Sets the long integer at the specified absolute index of this buffer in little endian byte order. This method does not modify readerIndex or writerIndex.
        Parameters:
        index - The index
        data - The long data
        Returns:
        This stream for chaining
      • readLong

        long readLong()
        Gets a long integer at the current readerIndex from this buffer and increases the readerIndex by 8.
        Returns:
        The long integer
      • readLongLE

        long readLongLE()
        Gets a long integer at the current readerIndex from this buffer in little endian byte order and increases the readerIndex by 8.
        Returns:
        The long integer
      • getLong

        long getLong​(int index)
        Gets a long integer at the specified absolute index from this buffer. This method does not modify readerIndex.
        Parameters:
        index - The index
        Returns:
        The long integer
      • getLongLE

        long getLongLE​(int index)
        Gets a long integer at the specified absolute index from this buffer in little endian byte order. This method does not modify readerIndex.
        Parameters:
        index - The index
        Returns:
        The long integer
      • writeFloat

        ChannelBuf writeFloat​(float data)
        Sets the specified float at the current writerIndex of this buffer and increases the writerIndex by 4.
        Parameters:
        data - The float data
        Returns:
        This stream for chaining
      • writeFloatLE

        ChannelBuf writeFloatLE​(float data)
        Sets the specified float at the current writerIndex of this buffer in little endian byte order and increases the writerIndex by 4.
        Parameters:
        data - The float data
        Returns:
        This stream for chaining
      • setFloat

        ChannelBuf setFloat​(int index,
                            float data)
        Sets the float at the specified absolute index of this buffer. This method does not modify readerIndex or writerIndex.
        Parameters:
        index - The index
        data - The float data
        Returns:
        This stream for chaining
      • setFloatLE

        ChannelBuf setFloatLE​(int index,
                              float data)
        Sets the float at the specified absolute index of this buffer in little endian byte order. This method does not modify readerIndex or writerIndex.
        Parameters:
        index - The index
        data - The float data
        Returns:
        This stream for chaining
      • readFloat

        float readFloat()
        Gets a float at the current readerIndex of this buffer and increases the readerIndex by 4.
        Returns:
        The float
      • readFloatLE

        float readFloatLE()
        Gets a float at the current readerIndex of this buffer in little endian byte order and increases the readerIndex by 4.
        Returns:
        The float
      • getFloat

        float getFloat​(int index)
        Gets a float at the specified absolute index from this buffer. This method does not modify readerIndex.
        Parameters:
        index - The index
        Returns:
        The string
      • getFloatLE

        float getFloatLE​(int index)
        Gets a float at the specified absolute index from this buffer in little endian byte order. This method does not modify readerIndex.
        Parameters:
        index - The index
        Returns:
        The string
      • writeDouble

        ChannelBuf writeDouble​(double data)
        Sets the specified double at the current writerIndex of this buffer and increases the writerIndex by 8.
        Parameters:
        data - The double data
        Returns:
        This stream for chaining
      • writeDoubleLE

        ChannelBuf writeDoubleLE​(double data)
        Sets the specified double at the current writerIndex of this buffer in little endian byte order and increases the writerIndex by 8.
        Parameters:
        data - The double data
        Returns:
        This stream for chaining
      • setDouble

        ChannelBuf setDouble​(int index,
                             double data)
        Sets the double at the specified absolute index of this buffer. This method does not modify readerIndex or writerIndex.
        Parameters:
        index - The index
        data - The double data
        Returns:
        This stream for chaining
      • setDoubleLE

        ChannelBuf setDoubleLE​(int index,
                               double data)
        Sets the double at the specified absolute index of this buffer in little endian byte order. This method does not modify readerIndex or writerIndex.
        Parameters:
        index - The index
        data - The double data
        Returns:
        This stream for chaining
      • readDouble

        double readDouble()
        Gets a double at the current readerIndex and increases the readerIndex by 8 in this buffer.
        Returns:
        The double
      • readDoubleLE

        double readDoubleLE()
        Gets a double at the current readerIndex from this buffer in little endian byte order and increases the readerIndex by 8.
        Returns:
        The double
      • getDouble

        double getDouble​(int index)
        Gets a double at the specified absolute index in this buffer. This method does not modify readerIndex.
        Parameters:
        index - The index
        Returns:
        The double
      • getDoubleLE

        double getDoubleLE​(int index)
        Gets a double at the specified absolute index from this buffer in little endian byte order. This method does not modify readerIndex.
        Parameters:
        index - The index
        Returns:
        The double
      • setVarInt

        ChannelBuf setVarInt​(int index,
                             int data)
        Sets the specified varint at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.

        The number of bytes written depends on the size of the value, see https://developers.google.com/protocol-buffers/docs/encoding#varints for a full description.

        Parameters:
        index - The index
        data - The varint data
        Returns:
        This stream for chaining
      • writeVarLong

        ChannelBuf writeVarLong​(long value)
        Sets the specified varlong at the current writerIndex and increases the writerIndex by the number of bytes written.

        The number of bytes written depends on the size of the value.

        Parameters:
        value - The varlong value
        Returns:
        This stream for chaining
      • setVarLong

        ChannelBuf setVarLong​(int index,
                              long value)
        Sets the specified varlong at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.

        The number of bytes written depends on the size of the value.

        Parameters:
        index - The index
        value - The varlong value
        Returns:
        This stream for chaining
      • readVarLong

        long readVarLong()
        Gets a varlong at the current readerIndex and increases the readerIndex by the number of bytes read.

        The number of bytes read depends on the size of the value.

        Returns:
        The varlong value
      • getVarLong

        long getVarLong​(int index)
        Gets a varlong at the specified absolute index in this buffer.

        The number of bytes read depends on the size of the value.

        Parameters:
        index - The index
        Returns:
        The varlong value
      • writeString

        ChannelBuf writeString​(String data)
        Sets the specified string at the current writerIndex and increases the writerIndex by the length of the string.

        The string will be encoded as the utf length as a varint followed by the UTF-8 bytes of the string.

        Parameters:
        data - The string data
        Returns:
        This stream for chaining
      • setString

        ChannelBuf setString​(int index,
                             String data)
        Sets the string at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.

        The string will be encoded as the utf length as a varint followed by the UTF-8 bytes of the string.

        Parameters:
        index - The index
        data - The string data
        Returns:
        This stream for chaining
      • readString

        String readString()
        Gets a string at the current readerIndex and increases the readerIndex by the length of a varint followed by the utf-8 bytes of the string.

        The string will be encoded as the utf length as a varint followed by the UTF-8 bytes of the string.

        Returns:
        The string
      • getString

        String getString​(int index)
        Gets a string at the specified absolute index in this buffer.

        The string will be encoded as the utf length as a varint followed by the UTF-8 bytes of the string.

        Parameters:
        index - The index
        Returns:
        The string
      • writeUTF

        ChannelBuf writeUTF​(String data)
        Sets the specified string at the current writerIndex and increases the writerIndex by the length of the string.

        The string will be encoded as the utf length as a short followed by the UTF-8 bytes of the string.

        Parameters:
        data - The string data
        Returns:
        This stream for chaining
      • setUTF

        ChannelBuf setUTF​(int index,
                          String data)
        Sets the string at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.

        The string will be encoded as the utf length as a short followed by the UTF-8 bytes of the string.

        Parameters:
        index - The index
        data - The string data
        Returns:
        This stream for chaining
      • readUTF

        String readUTF()
        Gets a string at the current readerIndex and increases the readerIndex by the length of a varint followed by the utf-8 bytes of the string.

        The string will be encoded as the utf length as a short followed by the UTF-8 bytes of the string.

        Returns:
        The string
      • getUTF

        String getUTF​(int index)
        Gets a string at the specified absolute index in this buffer.

        The string will be encoded as the utf length as a short followed by the UTF-8 bytes of the string.

        Parameters:
        index - The index
        Returns:
        The string
      • writeUniqueId

        ChannelBuf writeUniqueId​(UUID data)
        Sets the specified UUID at the current writerIndex and increases the writerIndex by 16 in this buffer.
        Parameters:
        data - The unique id data
        Returns:
        This stream for chaining
      • setUniqueId

        ChannelBuf setUniqueId​(int index,
                               UUID data)
        Sets the UUID at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
        Parameters:
        index - The index
        data - The unique id data
        Returns:
        This stream for chaining
      • readUniqueId

        UUID readUniqueId()
        Gets a UUID at the current readerIndex and increases the readerIndex by 16 in this buffer.
        Returns:
        This stream for chaining
      • getUniqueId

        UUID getUniqueId​(int index)
        Gets a UUID at the specified absolute index in this buffer.
        Parameters:
        index - The index
        Returns:
        The uuid
      • writeDataView

        ChannelBuf writeDataView​(DataView data)
        Sets the specified DataView at the current writerIndex and increases the writerIndex according to the length of the data view in this buffer.
        Parameters:
        data - The data view data
        Returns:
        This stream for chaining
      • setDataView

        ChannelBuf setDataView​(int index,
                               DataView data)
        Sets the DataView at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
        Parameters:
        index - The index
        data - The data view data
        Returns:
        This stream for chaining
      • readDataView

        DataView readDataView()
        Gets a DataView at the current readerIndex and increases the readerIndex according to the length of the data view in this buffer.
        Returns:
        The data view
      • getDataView

        DataView getDataView​(int index)
        Gets a DataView at the specified absolute index in this buffer.
        Parameters:
        index - The index
        Returns:
        The data view