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 Link icon

    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 Link icon

    • capacity Link icon

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

      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 Link icon

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

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

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

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

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

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

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

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

      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 Link icon

      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 Link icon

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

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

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

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

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

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

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

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

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

      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 Link icon

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

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

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

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

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

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

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

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

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

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

      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 Link icon

      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 Link icon

      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 Link icon

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

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

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