Class ReadOnlyUnsafeDirectByteBuf

All Implemented Interfaces:
ByteBufConvertible, ReferenceCounted, Comparable<ByteBuf>

final class ReadOnlyUnsafeDirectByteBuf extends ReadOnlyByteBufferBuf
Read-only ByteBuf which wraps a read-only direct ByteBuffer and use unsafe for best performance.
  • Field Details

    • memoryAddress

      private final long memoryAddress
  • Constructor Details

  • Method Details

    • _getByte

      protected byte _getByte(int index)
      Overrides:
      _getByte in class ReadOnlyByteBufferBuf
    • _getShort

      protected short _getShort(int index)
      Overrides:
      _getShort in class ReadOnlyByteBufferBuf
    • _getUnsignedMedium

      protected int _getUnsignedMedium(int index)
      Overrides:
      _getUnsignedMedium in class ReadOnlyByteBufferBuf
    • _getInt

      protected int _getInt(int index)
      Overrides:
      _getInt in class ReadOnlyByteBufferBuf
    • _getLong

      protected long _getLong(int index)
      Overrides:
      _getLong in class ReadOnlyByteBufferBuf
    • getBytes

      public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length)
      Description copied from class: ByteBuf
      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.
      Overrides:
      getBytes in class ReadOnlyByteBufferBuf
      Parameters:
      dstIndex - the first index of the destination
      length - the number of bytes to transfer
    • getBytes

      public ByteBuf getBytes(int index, byte[] dst, int dstIndex, int length)
      Description copied from class: ByteBuf
      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.
      Overrides:
      getBytes in class ReadOnlyByteBufferBuf
      Parameters:
      dstIndex - the first index of the destination
      length - the number of bytes to transfer
    • copy

      public ByteBuf copy(int index, int length)
      Description copied from class: ByteBuf
      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.
      Overrides:
      copy in class ReadOnlyByteBufferBuf
    • hasMemoryAddress

      public boolean hasMemoryAddress()
      Description copied from class: ByteBuf
      Returns true if and only if this buffer has a reference to the low-level memory address that points to the backing data.
      Overrides:
      hasMemoryAddress in class ReadOnlyByteBufferBuf
    • memoryAddress

      public long memoryAddress()
      Description copied from class: ByteBuf
      Returns the low-level memory address that point to the first byte of ths backing data.
      Overrides:
      memoryAddress in class ReadOnlyByteBufferBuf
    • addr

      private long addr(int index)