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

    Modifier and Type
    Method
    Description
    byte[]
    Gets the backing byte array of this stream.
    Gets this ChannelBuf as a InputStream.
    Gets this ChannelBuf as a OutputStream.
    int
    Gets the number of bytes available between the reader and the writer.
    int
    Gets the number of bytes this buffer can contain.
    Sets the readerIndex and writerIndex of this buffer to 0.
    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.
    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.
    getString(int index)
    Gets a string at the specified absolute index in this buffer.
    getUniqueId(int index)
    Gets a UUID at the specified absolute index in this buffer.
    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
    Returns true if and only if this buffer has a backing byte array.
    boolean
    Gets a boolean at the current readerIndex and increases the readerIndex by 1 in this buffer.
    byte
    Gets a byte at the current readerIndex and increases the readerIndex by 1 in this buffer.
    byte[]
    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
    Gets a character at the current readerIndex from this buffer and increases the readerIndex by 2.
    Gets a DataView at the current readerIndex and increases the readerIndex according to the length of the data view in this buffer.
    double
    Gets a double at the current readerIndex and increases the readerIndex by 8 in this buffer.
    double
    Gets a double at the current readerIndex from this buffer in little endian byte order and increases the readerIndex by 8.
    int
    Gets the readerIndex of this buffer.
    readerIndex(int index)
    Sets the readerIndex of this buffer.
    float
    Gets a float at the current readerIndex of this buffer and increases the readerIndex by 4.
    float
    Gets a float at the current readerIndex of this buffer in little endian byte order and increases the readerIndex by 4.
    int
    Gets an integer at the current readerIndex from this buffer and increases the readerIndex by 4.
    int
    Gets an integer at the current readerIndex in little endian byte order from this buffer and increases the readerIndex by 4.
    long
    Gets a long integer at the current readerIndex from this buffer and increases the readerIndex by 8.
    long
    Gets a long integer at the current readerIndex from this buffer in little endian byte order and increases the readerIndex by 8.
    short
    Gets a short integer at the current readerIndex from this buffer and increases the readerIndex by 2.
    short
    Gets a short integer at the current readerIndex from this buffer in little endian byte order and increases the readerIndex by 2.
    readSlice(int length)
    Returns a slice of this buffer's sub-region at the current readerIndex.
    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.
    Gets a UUID at the current readerIndex and increases the readerIndex by 16 in this buffer.
    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
    Gets a varint at the current readerIndex and increases the readerIndex by the number of bytes read.
    long
    Gets a varlong at the current readerIndex and increases the readerIndex by the number of bytes read.
    setBoolean(int index, boolean data)
    Sets the boolean at the specified absolute index in this buffer.
    setByte(int index, byte data)
    Sets the byte at the specified absolute index in this buffer.
    setByteArray(int index, byte[] data)
    Sets the specified byte array at the specified absolute index in this buffer.
    setByteArray(int index, byte[] data, int start, int length)
    Sets the specified byte array at the specified absolute index in this buffer.
    setBytes(int index, byte[] data)
    Sets the specified byte array at the specified absolute index in this buffer.
    setBytes(int index, byte[] data, int start, int length)
    Sets the specified byte array at the specified absolute index in this buffer.
    setChar(int index, char data)
    Sets the char at the specified absolute index of this buffer.
    setDataView(int index, DataView data)
    Sets the DataView at the specified absolute index in this buffer.
    setDouble(int index, double data)
    Sets the double at the specified absolute index of this buffer.
    setDoubleLE(int index, double data)
    Sets the double at the specified absolute index of this buffer in little endian byte order.
    setFloat(int index, float data)
    Sets the float at the specified absolute index of this buffer.
    setFloatLE(int index, float data)
    Sets the float at the specified absolute index of this buffer in little endian byte order.
    setIndex(int readIndex, int writeIndex)
    Sets both the reader and writer indices.
    setInt(int index, int data)
    Sets the integer at the specified absolute index of this buffer.
    setIntLE(int index, int data)
    Sets the integer at the specified absolute index of this buffer in little endian byte order.
    setLong(int index, long data)
    Sets the long integer at the specified absolute index of this buffer.
    setLongLE(int index, long data)
    Sets the long integer at the specified absolute index of this buffer in little endian byte order.
    setShort(int index, short data)
    Sets the short at the specified absolute index of this buffer.
    setShortLE(int index, short data)
    Sets the short at the specified absolute index of this buffer in little endian byte order.
    setString(int index, String data)
    Sets the string at the specified absolute index in this buffer.
    setUniqueId(int index, UUID data)
    Sets the UUID at the specified absolute index in this buffer.
    setUTF(int index, String data)
    Sets the string at the specified absolute index in this buffer.
    setVarInt(int index, int data)
    Sets the specified varint at the specified absolute index in this buffer.
    setVarLong(int index, long value)
    Sets the specified varlong at the specified absolute index in this buffer.
    Returns a slice of this buffer's readable bytes.
    slice(int index, int length)
    Returns a slice of this buffer's sub-region.
    writeBoolean(boolean data)
    Sets the specified boolean at the current writerIndex and increases the writerIndex by 1 in this buffer.
    writeByte(byte data)
    Sets the specified byte at the current writerIndex and increases the writerIndex by 1 in this buffer.
    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.
    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.
    writeBytes(byte[] data)
    Sets the specified byte array at the current writerIndex and increases the writerIndex by the number of bytes.
    writeBytes(byte[] data, int start, int length)
    Sets the specified byte array at the current writerIndex and increases the writerIndex by the length specified.
    writeChar(char data)
    Sets the specified character at the current writerIndex of this buffer and increases the writerIndex by 2.
    Sets the specified DataView at the current writerIndex and increases the writerIndex according to the length of the data view in this buffer.
    writeDouble(double data)
    Sets the specified double at the current writerIndex of this buffer and increases the writerIndex by 8.
    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.
    writeFloat(float data)
    Sets the specified float at the current writerIndex of this buffer and increases the writerIndex by 4.
    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.
    writeInt(int data)
    Sets the specified integer at the current writerIndex of this buffer and increases the writerIndex by 4.
    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.
    writeLong(long data)
    Sets the specified long integer at the current writerIndex of this buffer and increases the writerIndex by 8.
    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
    Gets the writerIndex of this buffer.
    writerIndex(int index)
    Sets the writerIndex of this buffer.
    writeShort(short data)
    Sets the specified short integer at the current writerIndex of this buffer and increases the writerIndex by 2.
    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.
    Sets the specified string at the current writerIndex and increases the writerIndex by the length of the string.
    Sets the specified UUID at the current writerIndex and increases the writerIndex by 16 in this buffer.
    Sets the specified string at the current writerIndex and increases the writerIndex by the length of the string.
    writeVarInt(int data)
    Sets the specified varint at the current writerIndex and increases the writerIndex by the number of bytes written.
    writeVarLong(long value)
    Sets the specified varlong at the current writerIndex and increases the writerIndex by the number of bytes written.
  • Method Details

    • 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
    • array

      byte[] array() throws UnsupportedOperationException
      Gets the backing byte array of this stream.
      Returns:
      A copy of the backing byte array
      Throws:
      UnsupportedOperationException - if there is no 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
    • writeVarInt

      ChannelBuf writeVarInt(int data)
      Sets the specified varint 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, see https://developers.google.com/protocol-buffers/docs/encoding#varints for a full description.

      Parameters:
      data - The varint data
      Returns:
      This stream for chaining
    • 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
    • readVarInt

      int readVarInt()
      Gets a varint 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, see https://developers.google.com/protocol-buffers/docs/encoding#varints for a full description.

      Returns:
      The varint
    • getVarInt

      int getVarInt(int index)
      Gets a varint at the specified absolute index in this buffer.

      The number of bytes read 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
      Returns:
      The double
    • 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
    • asOutputStream

      OutputStream asOutputStream()
      Gets this ChannelBuf as a OutputStream.
      Returns:
      The output stream
    • asInputStream

      InputStream asInputStream()
      Gets this ChannelBuf as a InputStream.
      Returns:
      The input stream