Class UncheckedByteArray

java.lang.Object
pcap.common.memory.UncheckedByteArray
All Implemented Interfaces:
Memory

@Inclubating
public class UncheckedByteArray
extends Object
Author:
Ardika Rommy Sanjaya
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected boolean freed  
  • Method Summary

    Modifier and Type Method Description
    int capacity()  
    Memory capacity​(int newCapacity)
    Adjusts the capacity of this buffer.
    Memory clear()
    Sets the readerIndex and writerIndex of this buffer to 0.
    Memory copy()
    Returns a copy of this buffer's readable bytes.
    UncheckedByteArray copy​(int index, int length)
    Returns a copy of this buffer's sub-region.
    UncheckedByteArray duplicate()
    Duplicate the this Memory buffer.
    Memory 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 (@code index) in this buffer.
    byte getByte​(int index)
    Gets a byte at the specified absolute index in this buffer.
    Memory getBytes​(int index, byte[] dst)
    Transfers this buffer's data to the specified destination starting at the specified absolute index.
    UncheckedByteArray getBytes​(int index, byte[] dst, int dstIndex, int length)
    Transfers this buffer's data to the specified destination starting at the specified absolute index.
    Memory getBytes​(int index, Memory dst)
    Transfers this buffer's data to the specified destination starting at the specified absolute index until the destination becomes non-writable.
    Memory getBytes​(int index, Memory dst, int length)
    Transfers this buffer's data to the specified destination starting at the specified absolute index.
    UncheckedByteArray getBytes​(int index, Memory dst, int dstIndex, int length)
    Transfers this buffer's data to the specified destination starting at the specified absolute index.
    CharSequence getCharSequence​(int index, int length, Charset charset)
    Gets a CharSequence with the given length at the given index.
    double getDouble​(int index)
    Gets a 64-bit floating point number at the specified absolute index in this buffer.
    double getDoubleLE​(int index)
    Gets a 64-bit floating point number at the specified absolute index in this buffer in Little Endian Byte Order.
    float getFloat​(int index)
    Gets a 32-bit floating point number at the specified absolute index in this buffer.
    float getFloatLE​(int index)
    Gets a 32-bit floating point number at the specified absolute index in this buffer in Little Endian Byte Order.
    int getInt​(int index)
    Gets a 32-bit integer at the specified absolute index in this buffer.
    int getIntLE​(int index)
    Gets a 32-bit integer at the specified absolute index in this buffer with Little Endian Byte Order.
    long getLong​(int index)
    Gets a 64-bit long integer at the specified absolute index in this buffer.
    long getLongLE​(int index)
    Gets a 64-bit long integer at the specified absolute index in this buffer in Little Endian Byte Order.
    short getShort​(int index)
    Gets a 16-bit short integer at the specified absolute index in this buffer.
    short getShortLE​(int index)
    Gets a 16-bit short integer at the specified absolute index in this buffer in Little Endian Byte Order.
    short getUnsignedByte​(int index)
    Gets an unsigned byte at the specified absolute index in this buffer.
    long getUnsignedInt​(int index)
    Gets an unsigned 32-bit integer at the specified absolute index in this buffer.
    long getUnsignedIntLE​(int index)
    Gets an unsigned 32-bit integer at the specified absolute index in this buffer in Little Endian Byte Order.
    int getUnsignedShort​(int index)
    Gets an unsigned 16-bit short integer at the specified absolute index in this buffer.
    int getUnsignedShortLE​(int index)
    Gets an unsigned 16-bit short integer at the specified absolute index in this buffer in Little Endian Byte Order.
    boolean isDirect()
    Returns true only if this buffer is an direct buffer, false otherwise.
    boolean isReadable()  
    boolean isReadable​(int numBytes)  
    boolean isWritable()  
    boolean isWritable​(int numBytes)  
    Memory markReaderIndex()
    Marks the current readerIndex in this buffer.
    Memory markWriterIndex()
    Marks the current writerIndex in this buffer.
    int maxCapacity()
    If a user attempts to increase the capacity of this buffer beyond the maximum capacity using Memory.capacity(int) or Memory.ensureWritable(int), those methods will raise an IllegalArgumentException.
    int maxWritableBytes()  
    long memoryAddress()  
    ByteBuffer nioBuffer()
    Exposes this Memory buffer's as an NIO ByteBuffer's.
    int readableBytes()  
    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.
    Memory readBytes​(byte[] dst)
    Transfers this buffer's data to the specified destination starting at the current readerIndex and increases the readerIndex by the number of the transferred bytes (= dst.length).
    Memory readBytes​(byte[] dst, int dstIndex, int length)
    Transfers this buffer's data to the specified destination starting at the current readerIndex and increases the readerIndex by the number of the transferred bytes (= length).
    Memory readBytes​(Memory dst)
    Transfers this buffer's data to the specified destination starting at the current readerIndex until the destination becomes non-writable, and increases the readerIndex by the number of the transferred bytes.
    Memory readBytes​(Memory dst, int length)
    Transfers this buffer's data to the specified destination starting at the current readerIndex and increases the readerIndex by the number of the transferred bytes (= length).
    Memory readBytes​(Memory dst, int dstIndex, int length)
    Transfers this buffer's data to the specified destination starting at the current readerIndex and increases the readerIndex by the number of the transferred bytes (= length).
    CharSequence readCharSequence​(int length, Charset charset)
    Gets a CharSequence with the given length at the current readerIndex and increases the readerIndex by the given length.
    double readDouble()
    Gets a 64-bit floating point number at the current readerIndex and increases the readerIndex by 8 in this buffer.
    double readDoubleLE()
    Gets a 64-bit floating point number at the current readerIndex in Little Endian Byte Order and increases the readerIndex by 8 in this buffer.
    int readerIndex()  
    Memory readerIndex​(int readerIndex)
    Sets the readerIndex of this buffer.
    float readFloat()
    Gets a 32-bit floating point number at the current readerIndex and increases the readerIndex by 4 in this buffer.
    float readFloatLE()
    Gets a 32-bit floating point number at the current readerIndex in Little Endian Byte Order and increases the readerIndex by 4 in this buffer.
    int readInt()
    Gets a 32-bit integer at the current readerIndex and increases the readerIndex by 4 in this buffer.
    int readIntLE()
    Gets a 32-bit integer at the current readerIndex in the Little Endian Byte Order and increases the readerIndex by 4 in this buffer.
    long readLong()
    Gets a 64-bit integer at the current readerIndex and increases the readerIndex by 8 in this buffer.
    long readLongLE()
    Gets a 64-bit integer at the current readerIndex in the Little Endian Byte Order and increases the readerIndex by 8 in this buffer.
    short readShort()
    Gets a 16-bit short integer at the current readerIndex and increases the readerIndex by 2 in this buffer.
    short readShortLE()
    Gets a 16-bit short integer at the current readerIndex in the Little Endian Byte Order and increases the readerIndex by 2 in this buffer.
    short readUnsignedByte()
    Gets an unsigned byte at the current readerIndex and increases the readerIndex by 1 in this buffer.
    long readUnsignedInt()
    Gets an unsigned 32-bit integer at the current readerIndex and increases the readerIndex by 4 in this buffer.
    long readUnsignedIntLE()
    Gets an unsigned 32-bit integer at the current readerIndex in the Little Endian Byte Order and increases the readerIndex by 4 in this buffer.
    int readUnsignedShort()
    Gets an unsigned 16-bit short integer at the current readerIndex and increases the readerIndex by 2 in this buffer.
    int readUnsignedShortLE()
    Gets an unsigned 16-bit short integer at the current readerIndex in the Little Endian Byte Order and increases the readerIndex by 2 in this buffer.
    void release()
    Deallocate/freeing this Memory buffer.
    Memory resetReaderIndex()
    Repositions the current readerIndex to the marked readerIndex in this buffer.
    Memory resetWriterIndex()
    Repositions the current writerIndex to the marked writerIndex in this buffer.
    Memory setBoolean​(int index, boolean value)
    Sets the specified boolean at the specified absolute index in this buffer.
    UncheckedByteArray setByte​(int index, int value)
    Sets the specified byte at the specified absolute index in this buffer.
    Memory setBytes​(int index, byte[] src)
    Transfers the specified source array's data to this buffer starting at the specified absolute index.
    UncheckedByteArray setBytes​(int index, byte[] src, int srcIndex, int length)
    Transfers the specified source array's data to this buffer starting at the specified absolute index.
    Memory setBytes​(int index, Memory src)
    Transfers the specified source buffer's data to this buffer starting at the specified absolute index until the source buffer becomes unreadable.
    Memory setBytes​(int index, Memory src, int length)
    Transfers the specified source buffer's data to this buffer starting at the specified absolute index.
    UncheckedByteArray setBytes​(int index, Memory src, int srcIndex, int length)
    Transfers the specified source buffer's data to this buffer starting at the specified absolute index.
    Memory setCharSequence​(int index, CharSequence seq, Charset charset)
    Writes the specified CharSequence at the current writerIndex and increases the writerIndex by the written bytes.
    Memory setDouble​(int index, double value)
    Sets the specified 64-bit floating-point number at the specified absolute index in this buffer.
    Memory setDoubleLE​(int index, double value)
    Sets the specified 64-bit floating-point number at the specified absolute index in this buffer in Little Endian Byte Order.
    Memory setFloat​(int index, float value)
    Sets the specified 32-bit floating-point number at the specified absolute index in this buffer.
    Memory setFloatLE​(int index, float value)
    Sets the specified 32-bit floating-point number at the specified absolute index in this buffer in Little Endian Byte Order.
    Memory setIndex​(int readerIndex, int writerIndex)
    Combination of writerIndex(...) and readerIndex(...).
    UncheckedByteArray setInt​(int index, int value)
    Sets the specified 32-bit integer at the specified absolute index in this buffer.
    UncheckedByteArray setIntLE​(int index, int value)
    Sets the specified 32-bit integer at the specified absolute index in this buffer with Little Endian byte order .
    UncheckedByteArray setLong​(int index, long value)
    Sets the specified 64-bit long integer at the specified absolute index in this buffer.
    UncheckedByteArray setLongLE​(int index, long value)
    Sets the specified 64-bit long integer at the specified absolute index in this buffer in Little Endian Byte Order.
    UncheckedByteArray setShort​(int index, int value)
    Sets the specified 16-bit short integer at the specified absolute index in this buffer.
    UncheckedByteArray setShortLE​(int index, int value)
    Sets the specified 16-bit short integer at the specified absolute index in this buffer with the Little Endian Byte Order.
    Memory skipBytes​(int length)
    Increases the current readerIndex by the specified length in this buffer.
    Memory slice()
    Returns a slice of this buffer's readable bytes.
    UncheckedByteArray slice​(int index, int length)
    Returns a slice of this buffer's sub-region.
    String toString()  
    int writableBytes()  
    Memory writeBoolean​(boolean value)
    Sets the specified boolean at the current writerIndex and increases the writerIndex by 1 in this buffer.
    Memory writeByte​(int value)
    Sets the specified byte at the current writerIndex and increases the writerIndex by 1 in this buffer.
    Memory writeBytes​(byte[] src)
    Transfers the specified source array's data to this buffer starting at the current writerIndex and increases the writerIndex by the number of the transferred bytes (= src.length).
    Memory writeBytes​(byte[] src, int srcIndex, int length)
    Transfers the specified source array's data to this buffer starting at the current writerIndex and increases the writerIndex by the number of the transferred bytes (= length).
    Memory writeBytes​(Memory src)
    Transfers the specified source buffer's data to this buffer starting at the current writerIndex until the source buffer becomes unreadable, and increases the writerIndex by the number of the transferred bytes.
    Memory writeBytes​(Memory src, int length)
    Transfers the specified source buffer's data to this buffer starting at the current writerIndex and increases the writerIndex by the number of the transferred bytes (= length).
    Memory writeBytes​(Memory src, int srcIndex, int length)
    Transfers the specified source buffer's data to this buffer starting at the current writerIndex and increases the writerIndex by the number of the transferred bytes (= length).
    Memory writeCharSequence​(CharSequence sequence, Charset charset)
    Writes the specified CharSequence at the current writerIndex and increases the writerIndex by the written bytes.
    Memory writeDouble​(double value)
    Sets the specified 64-bit floating point number at the current writerIndex and increases the writerIndex by 8 in this buffer.
    Memory writeDoubleLE​(double value)
    Sets the specified 64-bit floating point number at the current writerIndex in Little Endian Byte Order and increases the writerIndex by 8 in this buffer.
    Memory writeFloat​(float value)
    Sets the specified 32-bit floating point number at the current writerIndex and increases the writerIndex by 4 in this buffer.
    Memory writeFloatLE​(float value)
    Sets the specified 32-bit floating point number at the current writerIndex in Little Endian Byte Order and increases the writerIndex by 4 in this buffer.
    Memory writeInt​(int value)
    Sets the specified 32-bit integer at the current writerIndex and increases the writerIndex by 4 in this buffer.
    Memory writeIntLE​(int value)
    Sets the specified 32-bit integer at the current writerIndex in the Little Endian Byte Order and increases the writerIndex by 4 in this buffer.
    Memory writeLong​(long value)
    Sets the specified 64-bit long integer at the current writerIndex and increases the writerIndex by 8 in this buffer.
    Memory writeLongLE​(long value)
    Sets the specified 64-bit long integer at the current writerIndex in the Little Endian Byte Order and increases the writerIndex by 8 in this buffer.
    int writerIndex()  
    Memory writerIndex​(int writerIndex)
    Sets the writerIndex of this buffer.
    Memory writeShort​(int value)
    Sets the specified 16-bit short integer at the current writerIndex and increases the writerIndex by 2 in this buffer.
    Memory writeShortLE​(int value)
    Sets the specified 16-bit short integer in the Little Endian Byte Order at the current writerIndex and increases the writerIndex by 2 in this buffer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • freed

      protected boolean freed
  • Method Details

    • capacity

      public Memory capacity​(int newCapacity)
      Description copied from interface: Memory
      Adjusts the capacity of this buffer. If the newCapacity is less than the current capacity, the content of this buffer is truncated. If the newCapacity is greater than the current capacity, the buffer is appended with unspecified data whose length is (newCapacity - currentCapacity).
      Parameters:
      newCapacity - new capacity.
      Returns:
      returns this Memory.
    • getByte

      public byte getByte​(int index)
      Description copied from interface: Memory
      Gets a byte at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
      Returns:
      byte value.
    • getShort

      public short getShort​(int index)
      Description copied from interface: Memory
      Gets a 16-bit short integer at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
      Returns:
      short value.
    • getShortLE

      public short getShortLE​(int index)
      Description copied from interface: Memory
      Gets a 16-bit short integer at the specified absolute index in this buffer in Little Endian Byte Order. This method does not modify readerIndex or writerIndex of this buffer.
      Returns:
      little endian short value.
    • getInt

      public int getInt​(int index)
      Description copied from interface: Memory
      Gets a 32-bit integer at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
      Returns:
      integer value.
    • getIntLE

      public int getIntLE​(int index)
      Description copied from interface: Memory
      Gets a 32-bit integer at the specified absolute index in this buffer with Little Endian Byte Order. This method does not modify readerIndex or writerIndex of this buffer.
      Returns:
      little endian integer value.
    • getLong

      public long getLong​(int index)
      Description copied from interface: Memory
      Gets a 64-bit long integer at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
      Returns:
      long value.
    • getLongLE

      public long getLongLE​(int index)
      Description copied from interface: Memory
      Gets a 64-bit long integer at the specified absolute index in this buffer in Little Endian Byte Order. This method does not modify readerIndex or writerIndex of this buffer.
      Returns:
      little endian long value.
    • getBytes

      public UncheckedByteArray getBytes​(int index, Memory dst, int dstIndex, int length)
      Description copied from interface: Memory
      Transfers this buffer's data to the specified destination starting at the specified absolute index. This method does not modify readerIndex or writerIndex of both the source (i.e. this) and the destination.
      Parameters:
      index - index.
      dst - destination.
      dstIndex - the first index of the destination
      length - the number of bytes to transfer
      Returns:
      this Memory.
    • getBytes

      public UncheckedByteArray getBytes​(int index, byte[] dst, int dstIndex, int length)
      Description copied from interface: Memory
      Transfers this buffer's data to the specified destination starting at the specified absolute index. This method does not modify readerIndex or writerIndex of this buffer.
      Parameters:
      index - index.
      dst - destination.
      dstIndex - the first index of the destination
      length - the number of bytes to transfer
      Returns:
      this Memory.
    • setByte

      public UncheckedByteArray setByte​(int index, int value)
      Description copied from interface: Memory
      Sets the specified byte at the specified absolute index in this buffer. The 24 high-order bits of the specified value are ignored. This method does not modify readerIndex or writerIndex of this buffer.
      Parameters:
      index - index.
      value - value.
      Returns:
      this Memory.
    • setShort

      public UncheckedByteArray setShort​(int index, int value)
      Description copied from interface: Memory
      Sets the specified 16-bit short integer at the specified absolute index in this buffer. The 16 high-order bits of the specified value are ignored. This method does not modify readerIndex or writerIndex of this buffer.
      Parameters:
      index - index.
      value - value.
      Returns:
      this Memory.
    • setShortLE

      public UncheckedByteArray setShortLE​(int index, int value)
      Description copied from interface: Memory
      Sets the specified 16-bit short integer at the specified absolute index in this buffer with the Little Endian Byte Order. The 16 high-order bits of the specified value are ignored. This method does not modify readerIndex or writerIndex of this buffer.
      Parameters:
      index - index.
      value - value.
      Returns:
      this Memory.
    • setInt

      public UncheckedByteArray setInt​(int index, int value)
      Description copied from interface: Memory
      Sets the specified 32-bit integer at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
      Parameters:
      index - index.
      value - value.
      Returns:
      this Memory.
    • setIntLE

      public UncheckedByteArray setIntLE​(int index, int value)
      Description copied from interface: Memory
      Sets the specified 32-bit integer at the specified absolute index in this buffer with Little Endian byte order . This method does not modify readerIndex or writerIndex of this buffer.
      Parameters:
      index - index.
      value - value.
      Returns:
      this Memory.
    • setLong

      public UncheckedByteArray setLong​(int index, long value)
      Description copied from interface: Memory
      Sets the specified 64-bit long integer at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
      Parameters:
      index - index.
      value - value.
      Returns:
      this Memory.
    • setLongLE

      public UncheckedByteArray setLongLE​(int index, long value)
      Description copied from interface: Memory
      Sets the specified 64-bit long integer at the specified absolute index in this buffer in Little Endian Byte Order. This method does not modify readerIndex or writerIndex of this buffer.
      Parameters:
      index - index.
      value - value.
      Returns:
      this Memory.
    • setBytes

      public UncheckedByteArray setBytes​(int index, Memory src, int srcIndex, int length)
      Description copied from interface: Memory
      Transfers the specified source buffer's data to this buffer starting at the specified absolute index. This method does not modify readerIndex or writerIndex of both the source (i.e. this) and the destination.
      Parameters:
      index - index.
      src - source.
      srcIndex - the first index of the source
      length - the number of bytes to transfer
      Returns:
      this Memory.
    • setBytes

      public UncheckedByteArray setBytes​(int index, byte[] src, int srcIndex, int length)
      Description copied from interface: Memory
      Transfers the specified source array's data to this buffer starting at the specified absolute index. This method does not modify readerIndex or writerIndex of this buffer.
      Parameters:
      index - index.
      src - source.
      srcIndex - source index.
      length - length.
      Returns:
      this Memory.
    • copy

      public UncheckedByteArray copy​(int index, int length)
      Description copied from interface: Memory
      Returns a copy of this buffer's sub-region. Modifying the content of the returned buffer or this buffer does not affect each other at all. This method does not modify readerIndex or writerIndex of this buffer.
      Parameters:
      index - index.
      length - length.
      Returns:
      copied Memory buffer's.
    • slice

      public UncheckedByteArray slice​(int index, int length)
      Description copied from interface: Memory
      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 - index.
      length - length.
      Returns:
      returns sliced Memory buffer's.
    • duplicate

      public UncheckedByteArray duplicate()
      Description copied from interface: Memory
      Duplicate the this Memory buffer. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks
      Returns:
      returns duplicated Memory.
    • nioBuffer

      public ByteBuffer nioBuffer()
      Description copied from interface: Memory
      Exposes this Memory buffer's as an NIO ByteBuffer's. The returned buffer either share or contains the copied content of this buffer, while changing the position and limit of the returned NIO buffer does not affect the indexes and marks of this buffer. This method does not modify readerIndex or writerIndex of this buffer. Please note that the returned NIO buffer will not see the changes of this buffer if this buffer is a dynamic buffer and it adjusted its capacity and returned NIO buffer has no cleaner.
      Returns:
      returns direct ByteBuffer with no cleaner.
    • isDirect

      public boolean isDirect()
      Description copied from interface: Memory
      Returns true only if this buffer is an direct buffer, false otherwise.
    • memoryAddress

      public long memoryAddress()
      Returns:
      returns the low-level memory address that point to the first byte of ths backing data.
    • release

      public void release()
      Description copied from interface: Memory
      Deallocate/freeing this Memory buffer.
    • capacity

      public int capacity()
      Specified by:
      capacity in interface Memory
      Returns:
      returns the number of bytes (octets) this buffer can contain.
    • maxCapacity

      public int maxCapacity()
      Description copied from interface: Memory
      If a user attempts to increase the capacity of this buffer beyond the maximum capacity using Memory.capacity(int) or Memory.ensureWritable(int), those methods will raise an IllegalArgumentException.
      Specified by:
      maxCapacity in interface Memory
      Returns:
      returns the maximum allowed capacity of this buffer.
    • readerIndex

      public int readerIndex()
      Specified by:
      readerIndex in interface Memory
      Returns:
      returns the readerIndex of this buffer.
    • readerIndex

      public Memory readerIndex​(int readerIndex)
      Description copied from interface: Memory
      Sets the readerIndex of this buffer.
      Specified by:
      readerIndex in interface Memory
      Parameters:
      readerIndex - reader index.
      Returns:
      returns this Memory.
    • writerIndex

      public int writerIndex()
      Specified by:
      writerIndex in interface Memory
      Returns:
      returns the writerIndex of this buffer.
    • writerIndex

      public Memory writerIndex​(int writerIndex)
      Description copied from interface: Memory
      Sets the writerIndex of this buffer.
      Specified by:
      writerIndex in interface Memory
      Parameters:
      writerIndex - writer index.
      Returns:
      returns this Memory.
    • setIndex

      public Memory setIndex​(int readerIndex, int writerIndex)
      Description copied from interface: Memory
      Combination of writerIndex(...) and readerIndex(...).
      Specified by:
      setIndex in interface Memory
      Parameters:
      readerIndex - reader index.
      writerIndex - writer index.
      Returns:
      returns this Memory.
    • readableBytes

      public int readableBytes()
      Specified by:
      readableBytes in interface Memory
      Returns:
      returns the number of readable bytes which is equal to (this.writerIndex - this.readerIndex).
    • writableBytes

      public int writableBytes()
      Specified by:
      writableBytes in interface Memory
      Returns:
      returns the number of writable bytes which is equal to (this.capacity - this.writerIndex).
    • maxWritableBytes

      public int maxWritableBytes()
      Specified by:
      maxWritableBytes in interface Memory
      Returns:
      returns the maximum possible number of writable bytes, which is equal to (this.maxCapacity - this.writerIndex).
    • isReadable

      public boolean isReadable()
      Specified by:
      isReadable in interface Memory
      Returns:
      returns true if and only if (this.writerIndex - this.readerIndex) is greater than 0.
    • isReadable

      public boolean isReadable​(int numBytes)
      Specified by:
      isReadable in interface Memory
      Returns:
      returns true if and only if this buffer contains equal to or more than the specified number of elements.
    • isWritable

      public boolean isWritable()
      Specified by:
      isWritable in interface Memory
      Returns:
      returns true if and only if (this.capacity - this.writerIndex) is greater than 0.
    • isWritable

      public boolean isWritable​(int numBytes)
      Specified by:
      isWritable in interface Memory
      Returns:
      returns true if and only if this buffer has enough room to allow writing the specified number of elements.
    • clear

      public Memory clear()
      Description copied from interface: Memory
      Sets the readerIndex and writerIndex of this buffer to 0. This method is identical to setIndex(0, 0).
      Specified by:
      clear in interface Memory
      Returns:
      this Memory.
    • markReaderIndex

      public Memory markReaderIndex()
      Description copied from interface: Memory
      Marks the current readerIndex in this buffer. You can reposition the current readerIndex to the marked readerIndex by calling Memory.resetReaderIndex(). The initial value of the marked readerIndex is 0.
      Specified by:
      markReaderIndex in interface Memory
      Returns:
      this Memory.
    • resetReaderIndex

      public Memory resetReaderIndex()
      Description copied from interface: Memory
      Repositions the current readerIndex to the marked readerIndex in this buffer.
      Specified by:
      resetReaderIndex in interface Memory
      Returns:
      this Memory.
    • markWriterIndex

      public Memory markWriterIndex()
      Description copied from interface: Memory
      Marks the current writerIndex in this buffer. You can reposition the current writerIndex to the marked writerIndex by calling Memory.resetWriterIndex(). The initial value of the marked writerIndex is 0.
      Specified by:
      markWriterIndex in interface Memory
      Returns:
      this Memory.
    • resetWriterIndex

      public Memory resetWriterIndex()
      Description copied from interface: Memory
      Repositions the current writerIndex to the marked writerIndex in this buffer.
      Specified by:
      resetWriterIndex in interface Memory
      Returns:
      this Memory.
    • ensureWritable

      public Memory ensureWritable​(int minWritableBytes)
      Description copied from interface: Memory
      Makes sure the number of the writable bytes is equal to or greater than the specified value. If there is enough writable bytes in this buffer, this method returns with no side effect. Otherwise, it raises an IllegalArgumentException.
      Specified by:
      ensureWritable in interface Memory
      Parameters:
      minWritableBytes - the expected minimum number of writable bytes
      Returns:
      this Memory.
    • getBoolean

      public boolean getBoolean​(int index)
      Description copied from interface: Memory
      Gets a boolean at the specified absolute (@code index) in this buffer. This method does not modify the readerIndex or writerIndex of this buffer.
      Specified by:
      getBoolean in interface Memory
      Returns:
      boolean value.
    • getUnsignedByte

      public short getUnsignedByte​(int index)
      Description copied from interface: Memory
      Gets an unsigned byte at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
      Specified by:
      getUnsignedByte in interface Memory
      Returns:
      unsigned byte value stored in short.
    • getUnsignedShort

      public int getUnsignedShort​(int index)
      Description copied from interface: Memory
      Gets an unsigned 16-bit short integer at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
      Specified by:
      getUnsignedShort in interface Memory
      Returns:
      unsigned short value stored in integer.
    • getUnsignedShortLE

      public int getUnsignedShortLE​(int index)
      Description copied from interface: Memory
      Gets an unsigned 16-bit short integer at the specified absolute index in this buffer in Little Endian Byte Order. This method does not modify readerIndex or writerIndex of this buffer.
      Specified by:
      getUnsignedShortLE in interface Memory
      Returns:
      unsigned little endian short value stored in integer.
    • getUnsignedInt

      public long getUnsignedInt​(int index)
      Description copied from interface: Memory
      Gets an unsigned 32-bit integer at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
      Specified by:
      getUnsignedInt in interface Memory
      Returns:
      unsigned integer value stored in long.
    • getUnsignedIntLE

      public long getUnsignedIntLE​(int index)
      Description copied from interface: Memory
      Gets an unsigned 32-bit integer at the specified absolute index in this buffer in Little Endian Byte Order. This method does not modify readerIndex or writerIndex of this buffer.
      Specified by:
      getUnsignedIntLE in interface Memory
      Returns:
      unsigned little endian integer value stored in long.
    • getFloat

      public float getFloat​(int index)
      Description copied from interface: Memory
      Gets a 32-bit floating point number at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
      Specified by:
      getFloat in interface Memory
      Returns:
      float value.
    • getFloatLE

      public float getFloatLE​(int index)
      Description copied from interface: Memory
      Gets a 32-bit floating point number at the specified absolute index in this buffer in Little Endian Byte Order. This method does not modify readerIndex or writerIndex of this buffer.
      Specified by:
      getFloatLE in interface Memory
      Returns:
      little endian float value.
    • getDouble

      public double getDouble​(int index)
      Description copied from interface: Memory
      Gets a 64-bit floating point number at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
      Specified by:
      getDouble in interface Memory
      Returns:
      double value.
    • getDoubleLE

      public double getDoubleLE​(int index)
      Description copied from interface: Memory
      Gets a 64-bit floating point number at the specified absolute index in this buffer in Little Endian Byte Order. This method does not modify readerIndex or writerIndex of this buffer.
      Specified by:
      getDoubleLE in interface Memory
      Returns:
      little endian double value.
    • getBytes

      public Memory getBytes​(int index, Memory dst)
      Description copied from interface: Memory
      Transfers this buffer's data to the specified destination starting at the specified absolute index until the destination becomes non-writable. This method is basically same with Memory.getBytes(int, Memory, int, int), except that this method increases the writerIndex of the destination by the number of the transferred bytes while Memory.getBytes(int, Memory, int, int) does not. This method does not modify readerIndex or writerIndex of the source buffer (i.e. this).
      Specified by:
      getBytes in interface Memory
      Parameters:
      index - index.
      dst - destination.
      Returns:
      this Memory.
    • getBytes

      public Memory getBytes​(int index, Memory dst, int length)
      Description copied from interface: Memory
      Transfers this buffer's data to the specified destination starting at the specified absolute index. This method is basically same with Memory.getBytes(int, Memory, int, int), except that this method increases the writerIndex of the destination by the number of the transferred bytes while Memory.getBytes(int, Memory, int, int) does not. This method does not modify readerIndex or writerIndex of the source buffer (i.e. this).
      Specified by:
      getBytes in interface Memory
      Parameters:
      index - index.
      dst - destination.
      length - the number of bytes to transfer
      Returns:
      this Memory.
    • getBytes

      public Memory getBytes​(int index, byte[] dst)
      Description copied from interface: Memory
      Transfers this buffer's data to the specified destination starting at the specified absolute index. This method does not modify readerIndex or writerIndex of this buffer
      Specified by:
      getBytes in interface Memory
      Parameters:
      index - index.
      dst - destination.
      Returns:
      this Memory.
    • getCharSequence

      public CharSequence getCharSequence​(int index, int length, Charset charset)
      Description copied from interface: Memory
      Gets a CharSequence with the given length at the given index.
      Specified by:
      getCharSequence in interface Memory
      length - the length to read
      charset - that should be used
      Returns:
      the sequence
    • setBoolean

      public Memory setBoolean​(int index, boolean value)
      Description copied from interface: Memory
      Sets the specified boolean at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
      Specified by:
      setBoolean in interface Memory
      Parameters:
      index - index.
      value - value.
      Returns:
      this Memory.
    • setFloat

      public Memory setFloat​(int index, float value)
      Description copied from interface: Memory
      Sets the specified 32-bit floating-point number at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
      Specified by:
      setFloat in interface Memory
      Parameters:
      index - index.
      value - value.
      Returns:
      this Memory.
    • setFloatLE

      public Memory setFloatLE​(int index, float value)
      Description copied from interface: Memory
      Sets the specified 32-bit floating-point number at the specified absolute index in this buffer in Little Endian Byte Order. This method does not modify readerIndex or writerIndex of this buffer.
      Specified by:
      setFloatLE in interface Memory
      Parameters:
      index - index.
      value - value.
      Returns:
      this Memory.
    • setDouble

      public Memory setDouble​(int index, double value)
      Description copied from interface: Memory
      Sets the specified 64-bit floating-point number at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
      Specified by:
      setDouble in interface Memory
      Parameters:
      index - index.
      value - value.
      Returns:
      this Memory.
    • setDoubleLE

      public Memory setDoubleLE​(int index, double value)
      Description copied from interface: Memory
      Sets the specified 64-bit floating-point number at the specified absolute index in this buffer in Little Endian Byte Order. This method does not modify readerIndex or writerIndex of this buffer.
      Specified by:
      setDoubleLE in interface Memory
      Parameters:
      index - index.
      value - value.
      Returns:
      this Memory.
    • setBytes

      public Memory setBytes​(int index, Memory src)
      Description copied from interface: Memory
      Transfers the specified source buffer's data to this buffer starting at the specified absolute index until the source buffer becomes unreadable. This method is basically same with Memory.setBytes(int, Memory, int, int), except that this method increases the readerIndex of the source buffer by the number of the transferred bytes while Memory.setBytes(int, Memory, int, int) does not. This method does not modify readerIndex or writerIndex of the source buffer (i.e. this).
      Specified by:
      setBytes in interface Memory
      Parameters:
      index - index.
      src - source.
      Returns:
      this Memory.
    • setBytes

      public Memory setBytes​(int index, Memory src, int length)
      Description copied from interface: Memory
      Transfers the specified source buffer's data to this buffer starting at the specified absolute index. This method is basically same with Memory.setBytes(int, Memory, int, int), except that this method increases the readerIndex of the source buffer by the number of the transferred bytes while Memory.setBytes(int, Memory, int, int) does not. This method does not modify readerIndex or writerIndex of the source buffer (i.e. this).
      Specified by:
      setBytes in interface Memory
      Parameters:
      index - index.
      src - source.
      length - the number of bytes to transfer
      Returns:
      this Memory.
    • setBytes

      public Memory setBytes​(int index, byte[] src)
      Description copied from interface: Memory
      Transfers the specified source array's data to this buffer starting at the specified absolute index. This method does not modify readerIndex or writerIndex of this buffer.
      Specified by:
      setBytes in interface Memory
      Parameters:
      index - index.
      src - source.
      Returns:
      this Memory.
    • setCharSequence

      public Memory setCharSequence​(int index, CharSequence seq, Charset charset)
      Description copied from interface: Memory
      Writes the specified CharSequence at the current writerIndex and increases the writerIndex by the written bytes.
      Specified by:
      setCharSequence in interface Memory
      Parameters:
      index - on which the sequence should be written.
      seq - to write.
      charset - that should be used.
      Returns:
      this Memory.
    • readBoolean

      public boolean readBoolean()
      Description copied from interface: Memory
      Gets a boolean at the current readerIndex and increases the readerIndex by 1 in this buffer.
      Specified by:
      readBoolean in interface Memory
      Returns:
      boolean value.
    • readByte

      public byte readByte()
      Description copied from interface: Memory
      Gets a byte at the current readerIndex and increases the readerIndex by 1 in this buffer.
      Specified by:
      readByte in interface Memory
      Returns:
      byte value.
    • readUnsignedByte

      public short readUnsignedByte()
      Description copied from interface: Memory
      Gets an unsigned byte at the current readerIndex and increases the readerIndex by 1 in this buffer.
      Specified by:
      readUnsignedByte in interface Memory
      Returns:
      unsigned byte stored in short.
    • readShort

      public short readShort()
      Description copied from interface: Memory
      Gets a 16-bit short integer at the current readerIndex and increases the readerIndex by 2 in this buffer.
      Specified by:
      readShort in interface Memory
      Returns:
      short value.
    • readShortLE

      public short readShortLE()
      Description copied from interface: Memory
      Gets a 16-bit short integer at the current readerIndex in the Little Endian Byte Order and increases the readerIndex by 2 in this buffer.
      Specified by:
      readShortLE in interface Memory
      Returns:
      little endian short value.
    • readUnsignedShort

      public int readUnsignedShort()
      Description copied from interface: Memory
      Gets an unsigned 16-bit short integer at the current readerIndex and increases the readerIndex by 2 in this buffer.
      Specified by:
      readUnsignedShort in interface Memory
      Returns:
      unsigned short value stored in integer.
    • readUnsignedShortLE

      public int readUnsignedShortLE()
      Description copied from interface: Memory
      Gets an unsigned 16-bit short integer at the current readerIndex in the Little Endian Byte Order and increases the readerIndex by 2 in this buffer.
      Specified by:
      readUnsignedShortLE in interface Memory
      Returns:
      unsigned little endian short value stored in integer.
    • readInt

      public int readInt()
      Description copied from interface: Memory
      Gets a 32-bit integer at the current readerIndex and increases the readerIndex by 4 in this buffer.
      Specified by:
      readInt in interface Memory
      Returns:
      integer value.
    • readIntLE

      public int readIntLE()
      Description copied from interface: Memory
      Gets a 32-bit integer at the current readerIndex in the Little Endian Byte Order and increases the readerIndex by 4 in this buffer.
      Specified by:
      readIntLE in interface Memory
      Returns:
      little endian integer value.
    • readUnsignedInt

      public long readUnsignedInt()
      Description copied from interface: Memory
      Gets an unsigned 32-bit integer at the current readerIndex and increases the readerIndex by 4 in this buffer.
      Specified by:
      readUnsignedInt in interface Memory
      Returns:
      unsigned integer value.
    • readUnsignedIntLE

      public long readUnsignedIntLE()
      Description copied from interface: Memory
      Gets an unsigned 32-bit integer at the current readerIndex in the Little Endian Byte Order and increases the readerIndex by 4 in this buffer.
      Specified by:
      readUnsignedIntLE in interface Memory
      Returns:
      unsigned little endian integer value.
    • readFloat

      public float readFloat()
      Description copied from interface: Memory
      Gets a 32-bit floating point number at the current readerIndex and increases the readerIndex by 4 in this buffer.
      Specified by:
      readFloat in interface Memory
      Returns:
      float value.
    • readFloatLE

      public float readFloatLE()
      Description copied from interface: Memory
      Gets a 32-bit floating point number at the current readerIndex in Little Endian Byte Order and increases the readerIndex by 4 in this buffer.
      Specified by:
      readFloatLE in interface Memory
      Returns:
      little endian float value.
    • readDouble

      public double readDouble()
      Description copied from interface: Memory
      Gets a 64-bit floating point number at the current readerIndex and increases the readerIndex by 8 in this buffer.
      Specified by:
      readDouble in interface Memory
      Returns:
      double value.
    • readDoubleLE

      public double readDoubleLE()
      Description copied from interface: Memory
      Gets a 64-bit floating point number at the current readerIndex in Little Endian Byte Order and increases the readerIndex by 8 in this buffer.
      Specified by:
      readDoubleLE in interface Memory
      Returns:
      little endian double value.
    • readLong

      public long readLong()
      Description copied from interface: Memory
      Gets a 64-bit integer at the current readerIndex and increases the readerIndex by 8 in this buffer.
      Specified by:
      readLong in interface Memory
      Returns:
      long value.
    • readLongLE

      public long readLongLE()
      Description copied from interface: Memory
      Gets a 64-bit integer at the current readerIndex in the Little Endian Byte Order and increases the readerIndex by 8 in this buffer.
      Specified by:
      readLongLE in interface Memory
      Returns:
      little endian long value.
    • readBytes

      public Memory readBytes​(Memory dst)
      Description copied from interface: Memory
      Transfers this buffer's data to the specified destination starting at the current readerIndex until the destination becomes non-writable, and increases the readerIndex by the number of the transferred bytes. This method is basically same with Memory.readBytes(Memory, int, int), except that this method increases the writerIndex of the destination by the number of the transferred bytes while Memory.readBytes(Memory, int, int) does not.
      Specified by:
      readBytes in interface Memory
      Returns:
      this Memory.
    • readBytes

      public Memory readBytes​(Memory dst, int length)
      Description copied from interface: Memory
      Transfers this buffer's data to the specified destination starting at the current readerIndex and increases the readerIndex by the number of the transferred bytes (= length). This method is basically same with Memory.readBytes(Memory, int, int), except that this method increases the writerIndex of the destination by the number of the transferred bytes (= length) while Memory.readBytes(Memory, int, int) does not.
      Specified by:
      readBytes in interface Memory
    • readBytes

      public Memory readBytes​(Memory dst, int dstIndex, int length)
      Description copied from interface: Memory
      Transfers this buffer's data to the specified destination starting at the current readerIndex and increases the readerIndex by the number of the transferred bytes (= length).
      Specified by:
      readBytes in interface Memory
      Parameters:
      dst - destination.
      dstIndex - the first index of the destination
      length - the number of bytes to transfer
      Returns:
      this Memory.
    • readBytes

      public Memory readBytes​(byte[] dst)
      Description copied from interface: Memory
      Transfers this buffer's data to the specified destination starting at the current readerIndex and increases the readerIndex by the number of the transferred bytes (= dst.length).
      Specified by:
      readBytes in interface Memory
      Parameters:
      dst - destination.
      Returns:
      this Memory.
    • readBytes

      public Memory readBytes​(byte[] dst, int dstIndex, int length)
      Description copied from interface: Memory
      Transfers this buffer's data to the specified destination starting at the current readerIndex and increases the readerIndex by the number of the transferred bytes (= length).
      Specified by:
      readBytes in interface Memory
      Parameters:
      dst - destination.
      dstIndex - the first index of the destination
      length - the number of bytes to transfer
      Returns:
      this Memory.
    • skipBytes

      public Memory skipBytes​(int length)
      Description copied from interface: Memory
      Increases the current readerIndex by the specified length in this buffer.
      Specified by:
      skipBytes in interface Memory
      Returns:
      this Memory.
    • readCharSequence

      public CharSequence readCharSequence​(int length, Charset charset)
      Description copied from interface: Memory
      Gets a CharSequence with the given length at the current readerIndex and increases the readerIndex by the given length.
      Specified by:
      readCharSequence in interface Memory
      Parameters:
      length - the length to read
      charset - that should be used
      Returns:
      the char sequence.
    • writeBoolean

      public Memory writeBoolean​(boolean value)
      Description copied from interface: Memory
      Sets the specified boolean at the current writerIndex and increases the writerIndex by 1 in this buffer.
      Specified by:
      writeBoolean in interface Memory
      Returns:
      this Memory.
    • writeByte

      public Memory writeByte​(int value)
      Description copied from interface: Memory
      Sets the specified byte at the current writerIndex and increases the writerIndex by 1 in this buffer. The 24 high-order bits of the specified value are ignored.
      Specified by:
      writeByte in interface Memory
      Returns:
      this Memory.
    • writeShort

      public Memory writeShort​(int value)
      Description copied from interface: Memory
      Sets the specified 16-bit short integer at the current writerIndex and increases the writerIndex by 2 in this buffer. The 16 high-order bits of the specified value are ignored.
      Specified by:
      writeShort in interface Memory
      Returns:
      this Memory.
    • writeShortLE

      public Memory writeShortLE​(int value)
      Description copied from interface: Memory
      Sets the specified 16-bit short integer in the Little Endian Byte Order at the current writerIndex and increases the writerIndex by 2 in this buffer. The 16 high-order bits of the specified value are ignored.
      Specified by:
      writeShortLE in interface Memory
      Returns:
      this Memory.
    • writeInt

      public Memory writeInt​(int value)
      Description copied from interface: Memory
      Sets the specified 32-bit integer at the current writerIndex and increases the writerIndex by 4 in this buffer.
      Specified by:
      writeInt in interface Memory
      Returns:
      this Memory.
    • writeIntLE

      public Memory writeIntLE​(int value)
      Description copied from interface: Memory
      Sets the specified 32-bit integer at the current writerIndex in the Little Endian Byte Order and increases the writerIndex by 4 in this buffer.
      Specified by:
      writeIntLE in interface Memory
      Returns:
      this Memory.
    • writeLong

      public Memory writeLong​(long value)
      Description copied from interface: Memory
      Sets the specified 64-bit long integer at the current writerIndex and increases the writerIndex by 8 in this buffer.
      Specified by:
      writeLong in interface Memory
      Returns:
      this Memory.
    • writeLongLE

      public Memory writeLongLE​(long value)
      Description copied from interface: Memory
      Sets the specified 64-bit long integer at the current writerIndex in the Little Endian Byte Order and increases the writerIndex by 8 in this buffer.
      Specified by:
      writeLongLE in interface Memory
      Returns:
      this Memory.
    • writeFloat

      public Memory writeFloat​(float value)
      Description copied from interface: Memory
      Sets the specified 32-bit floating point number at the current writerIndex and increases the writerIndex by 4 in this buffer.
      Specified by:
      writeFloat in interface Memory
      Returns:
      this Memory.
    • writeFloatLE

      public Memory writeFloatLE​(float value)
      Description copied from interface: Memory
      Sets the specified 32-bit floating point number at the current writerIndex in Little Endian Byte Order and increases the writerIndex by 4 in this buffer.
      Specified by:
      writeFloatLE in interface Memory
      Returns:
      this Memory.
    • writeDoubleLE

      public Memory writeDoubleLE​(double value)
      Description copied from interface: Memory
      Sets the specified 64-bit floating point number at the current writerIndex in Little Endian Byte Order and increases the writerIndex by 8 in this buffer.
      Specified by:
      writeDoubleLE in interface Memory
      Returns:
      this Memory.
    • writeDouble

      public Memory writeDouble​(double value)
      Description copied from interface: Memory
      Sets the specified 64-bit floating point number at the current writerIndex and increases the writerIndex by 8 in this buffer.
      Specified by:
      writeDouble in interface Memory
      Returns:
      this Memory.
    • writeBytes

      public Memory writeBytes​(Memory src)
      Description copied from interface: Memory
      Transfers the specified source buffer's data to this buffer starting at the current writerIndex until the source buffer becomes unreadable, and increases the writerIndex by the number of the transferred bytes. This method is basically same with Memory.writeBytes(Memory, int, int), except that this method increases the readerIndex of the source buffer by the number of the transferred bytes while Memory.writeBytes(Memory, int, int) does not.
      Specified by:
      writeBytes in interface Memory
      Returns:
      this Memory.
    • writeBytes

      public Memory writeBytes​(Memory src, int length)
      Description copied from interface: Memory
      Transfers the specified source buffer's data to this buffer starting at the current writerIndex and increases the writerIndex by the number of the transferred bytes (= length). This method is basically same with Memory.writeBytes(Memory, int, int), except that this method increases the readerIndex of the source buffer by the number of the transferred bytes (= length) while Memory.writeBytes(Memory, int, int) does not.
      Specified by:
      writeBytes in interface Memory
      Parameters:
      src - source.
      length - the number of bytes to transfer.
      Returns:
      this Memory.
    • writeBytes

      public Memory writeBytes​(Memory src, int srcIndex, int length)
      Description copied from interface: Memory
      Transfers the specified source buffer's data to this buffer starting at the current writerIndex and increases the writerIndex by the number of the transferred bytes (= length).
      Specified by:
      writeBytes in interface Memory
      Parameters:
      src - source.
      srcIndex - the first index of the source
      length - the number of bytes to transfer
      Returns:
      this Memory.
    • writeBytes

      public Memory writeBytes​(byte[] src)
      Description copied from interface: Memory
      Transfers the specified source array's data to this buffer starting at the current writerIndex and increases the writerIndex by the number of the transferred bytes (= src.length).
      Specified by:
      writeBytes in interface Memory
      Parameters:
      src - source.
      Returns:
      this Memory.
    • writeBytes

      public Memory writeBytes​(byte[] src, int srcIndex, int length)
      Description copied from interface: Memory
      Transfers the specified source array's data to this buffer starting at the current writerIndex and increases the writerIndex by the number of the transferred bytes (= length).
      Specified by:
      writeBytes in interface Memory
      Parameters:
      src - source.
      srcIndex - the first index of the source
      length - the number of bytes to transfer
      Returns:
      this Memory.
    • writeCharSequence

      public Memory writeCharSequence​(CharSequence sequence, Charset charset)
      Description copied from interface: Memory
      Writes the specified CharSequence at the current writerIndex and increases the writerIndex by the written bytes. in this buffer.
      Specified by:
      writeCharSequence in interface Memory
      Parameters:
      sequence - to write.
      charset - that should be used.
      Returns:
      the written number of bytes.
    • copy

      public Memory copy()
      Description copied from interface: Memory
      Returns a copy of this buffer's readable bytes. Modifying the content of the returned buffer or this buffer does not affect each other at all. This method is identical to copy(readerIndex(), readableBytes()). This method does not modify readerIndex or writerIndex of this buffer.
      Specified by:
      copy in interface Memory
      Returns:
      copied Memory buffer's.
    • slice

      public Memory slice()
      Description copied from interface: Memory
      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 slice(readerIndex(), readableBytes()). This method does not modify readerIndex or writerIndex of this buffer.
      Specified by:
      slice in interface Memory
      Returns:
      returns sliced Memory buffer's.
    • toString

      public String toString()
      Overrides:
      toString in class Object