Class PooledUnsafeDirectByteBuf

    • Method Detail

      • init

        void init​(PoolChunk<java.nio.ByteBuffer> chunk,
                  java.nio.ByteBuffer nioBuffer,
                  long handle,
                  int offset,
                  int length,
                  int maxLength,
                  PoolThreadCache cache)
        Overrides:
        init in class PooledByteBuf<java.nio.ByteBuffer>
      • initMemoryAddress

        private void initMemoryAddress()
      • newInternalNioBuffer

        protected java.nio.ByteBuffer newInternalNioBuffer​(java.nio.ByteBuffer memory)
        Specified by:
        newInternalNioBuffer in class PooledByteBuf<java.nio.ByteBuffer>
      • isDirect

        public boolean isDirect()
        Description copied from class: ByteBuf
        Returns true if and only if this buffer is backed by an NIO direct buffer.
        Specified by:
        isDirect in class ByteBuf
      • 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.
        Specified by:
        getBytes in class ByteBuf
        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.
        Specified by:
        getBytes in class ByteBuf
        dstIndex - the first index of the destination
        length - the number of bytes to transfer
      • getBytes

        public ByteBuf getBytes​(int index,
                                java.nio.ByteBuffer dst)
        Description copied from class: ByteBuf
        Transfers this buffer's data to the specified destination starting at the specified absolute index until the destination's position reaches its limit. This method does not modify readerIndex or writerIndex of this buffer while the destination's position will be increased.
        Specified by:
        getBytes in class ByteBuf
      • getBytes

        public ByteBuf getBytes​(int index,
                                java.io.OutputStream out,
                                int length)
                         throws java.io.IOException
        Description copied from class: ByteBuf
        Transfers this buffer's data to the specified stream starting at the specified absolute index. This method does not modify readerIndex or writerIndex of this buffer.
        Specified by:
        getBytes in class ByteBuf
        length - the number of bytes to transfer
        Throws:
        java.io.IOException - if the specified stream threw an exception during I/O
      • _setInt

        protected void _setInt​(int index,
                               int value)
        Specified by:
        _setInt in class AbstractByteBuf
      • setBytes

        public ByteBuf setBytes​(int index,
                                ByteBuf src,
                                int srcIndex,
                                int length)
        Description copied from class: ByteBuf
        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.
        Specified by:
        setBytes in class ByteBuf
        srcIndex - the first index of the source
        length - the number of bytes to transfer
      • setBytes

        public ByteBuf setBytes​(int index,
                                byte[] src,
                                int srcIndex,
                                int length)
        Description copied from class: ByteBuf
        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 class ByteBuf
      • setBytes

        public ByteBuf setBytes​(int index,
                                java.nio.ByteBuffer src)
        Description copied from class: ByteBuf
        Transfers the specified source buffer's data to this buffer starting at the specified absolute index until the source buffer's position reaches its limit. This method does not modify readerIndex or writerIndex of this buffer.
        Specified by:
        setBytes in class ByteBuf
      • setBytes

        public int setBytes​(int index,
                            java.io.InputStream in,
                            int length)
                     throws java.io.IOException
        Description copied from class: ByteBuf
        Transfers the content of the specified source stream to this buffer starting at the specified absolute index. This method does not modify readerIndex or writerIndex of this buffer.
        Specified by:
        setBytes in class ByteBuf
        length - the number of bytes to transfer
        Returns:
        the actual number of bytes read in from the specified channel. -1 if the specified InputStream reached EOF.
        Throws:
        java.io.IOException - if the specified stream threw an exception during I/O
      • 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.
        Specified by:
        copy in class ByteBuf
      • array

        public byte[] array()
        Description copied from class: ByteBuf
        Returns the backing byte array of this buffer.
        Specified by:
        array in class ByteBuf
      • arrayOffset

        public int arrayOffset()
        Description copied from class: ByteBuf
        Returns the offset of the first byte within the backing byte array of this buffer.
        Specified by:
        arrayOffset in class ByteBuf
      • 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.
        Specified by:
        hasMemoryAddress in class ByteBuf
      • 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.
        Specified by:
        memoryAddress in class ByteBuf
      • addr

        private long addr​(int index)
      • setZero

        public ByteBuf setZero​(int index,
                               int length)
        Description copied from class: ByteBuf
        Fills this buffer with NUL (0x00) starting at the specified absolute index. This method does not modify readerIndex or writerIndex of this buffer.
        Overrides:
        setZero in class AbstractByteBuf
        length - the number of NULs to write to the buffer
      • writeZero

        public ByteBuf writeZero​(int length)
        Description copied from class: ByteBuf
        Fills this buffer with NUL (0x00) starting at the current writerIndex and increases the writerIndex by the specified length. If this.writableBytes is less than length, ByteBuf.ensureWritable(int) will be called in an attempt to expand capacity to accommodate.
        Overrides:
        writeZero in class AbstractByteBuf
        Parameters:
        length - the number of NULs to write to the buffer