Class CompositeByteBuf

    • Constructor Detail

      • CompositeByteBuf

        public CompositeByteBuf​(ByteBufAllocator alloc,
                                boolean direct,
                                int maxNumComponents)
      • CompositeByteBuf

        public CompositeByteBuf​(ByteBufAllocator alloc,
                                boolean direct,
                                int maxNumComponents,
                                ByteBuf... buffers)
      • CompositeByteBuf

        public CompositeByteBuf​(ByteBufAllocator alloc,
                                boolean direct,
                                int maxNumComponents,
                                java.lang.Iterable<ByteBuf> buffers)
    • Method Detail

      • removeComponent

        public CompositeByteBuf removeComponent​(int cIndex)
        Remove the ByteBuf from the given index.
        Parameters:
        cIndex - the index on from which the ByteBuf will be remove
      • removeComponents

        public CompositeByteBuf removeComponents​(int cIndex,
                                                 int numComponents)
        Remove the number of ByteBufs starting from the given index.
        Parameters:
        cIndex - the index on which the ByteBufs will be started to removed
        numComponents - the number of components to remove
      • iterator

        public java.util.Iterator<ByteBuf> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<ByteBuf>
      • forEachByteAsc0

        protected int forEachByteAsc0​(int start,
                                      int end,
                                      ByteProcessor processor)
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • forEachByteDesc0

        protected int forEachByteDesc0​(int rStart,
                                       int rEnd,
                                       ByteProcessor processor)
                                throws java.lang.Exception
        Throws:
        java.lang.Exception
      • 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
      • 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
      • capacity

        public int capacity()
        Description copied from class: ByteBuf
        Returns the number of bytes (octets) this buffer can contain.
        Specified by:
        capacity in class ByteBuf
      • capacity

        public CompositeByteBuf capacity​(int newCapacity)
        Description copied from class: ByteBuf
        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).
        Specified by:
        capacity in class ByteBuf
      • order

        public java.nio.ByteOrder order()
        Description copied from class: ByteBuf
        Returns the endianness of this buffer.
        Specified by:
        order in class ByteBuf
      • numComponents

        public int numComponents()
        Return the current number of ByteBuf's that are composed in this instance
      • maxNumComponents

        public int maxNumComponents()
        Return the max number of ByteBuf's that are composed in this instance
      • toComponentIndex

        public int toComponentIndex​(int offset)
        Return the index for the given offset
      • toByteIndex

        public int toByteIndex​(int cIndex)
      • getByte

        public byte getByte​(int index)
        Description copied from class: ByteBuf
        Gets a byte at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
        Overrides:
        getByte in class AbstractByteBuf
      • getBytes

        public CompositeByteBuf 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 CompositeByteBuf 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 CompositeByteBuf 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 int getBytes​(int index,
                            java.nio.channels.GatheringByteChannel out,
                            int length)
                     throws java.io.IOException
        Description copied from class: ByteBuf
        Transfers this buffer's data to the specified channel 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 maximum number of bytes to transfer
        Returns:
        the actual number of bytes written out to the specified channel
        Throws:
        java.io.IOException - if the specified channel threw an exception during I/O
      • getBytes

        public int getBytes​(int index,
                            java.nio.channels.FileChannel out,
                            long position,
                            int length)
                     throws java.io.IOException
        Description copied from class: ByteBuf
        Transfers this buffer's data starting at the specified absolute index to the specified channel starting at the given file position. This method does not modify readerIndex or writerIndex of this buffer. This method does not modify the channel's position.
        Specified by:
        getBytes in class ByteBuf
        position - the file position at which the transfer is to begin
        length - the maximum number of bytes to transfer
        Returns:
        the actual number of bytes written out to the specified channel
        Throws:
        java.io.IOException - if the specified channel threw an exception during I/O
      • getBytes

        public CompositeByteBuf 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
      • setByte

        public CompositeByteBuf setByte​(int index,
                                        int value)
        Description copied from class: ByteBuf
        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.
        Overrides:
        setByte in class AbstractByteBuf
      • setShort

        public CompositeByteBuf setShort​(int index,
                                         int value)
        Description copied from class: ByteBuf
        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.
        Overrides:
        setShort in class AbstractByteBuf
      • setMedium

        public CompositeByteBuf setMedium​(int index,
                                          int value)
        Description copied from class: ByteBuf
        Sets the specified 24-bit medium integer at the specified absolute index in this buffer. Please note that the most significant byte is ignored in the specified value. This method does not modify readerIndex or writerIndex of this buffer.
        Overrides:
        setMedium in class AbstractByteBuf
      • setInt

        public CompositeByteBuf setInt​(int index,
                                       int value)
        Description copied from class: ByteBuf
        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.
        Overrides:
        setInt in class AbstractByteBuf
      • _setInt

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

        public CompositeByteBuf setLong​(int index,
                                        long value)
        Description copied from class: ByteBuf
        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.
        Overrides:
        setLong in class AbstractByteBuf
      • setBytes

        public CompositeByteBuf 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 CompositeByteBuf 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 CompositeByteBuf 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 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
      • setBytes

        public int setBytes​(int index,
                            java.nio.channels.ScatteringByteChannel in,
                            int length)
                     throws java.io.IOException
        Description copied from class: ByteBuf
        Transfers the content of the specified source channel 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 maximum number of bytes to transfer
        Returns:
        the actual number of bytes read in from the specified channel. -1 if the specified channel is closed or it reached EOF.
        Throws:
        java.io.IOException - if the specified channel threw an exception during I/O
      • setBytes

        public int setBytes​(int index,
                            java.nio.channels.FileChannel in,
                            long position,
                            int length)
                     throws java.io.IOException
        Description copied from class: ByteBuf
        Transfers the content of the specified source channel starting at the given file position to this buffer starting at the specified absolute index. This method does not modify readerIndex or writerIndex of this buffer. This method does not modify the channel's position.
        Specified by:
        setBytes in class ByteBuf
        position - the file position at which the transfer is to begin
        length - the maximum number of bytes to transfer
        Returns:
        the actual number of bytes read in from the specified channel. -1 if the specified channel is closed or it reached EOF.
        Throws:
        java.io.IOException - if the specified channel 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
      • component

        public ByteBuf component​(int cIndex)
        Return the ByteBuf on the specified index
        Parameters:
        cIndex - the index for which the ByteBuf should be returned
        Returns:
        buf the ByteBuf on the specified index
      • componentAtOffset

        public ByteBuf componentAtOffset​(int offset)
        Return the ByteBuf on the specified index
        Parameters:
        offset - the offset for which the ByteBuf should be returned
        Returns:
        the ByteBuf on the specified index
      • internalComponent

        public ByteBuf internalComponent​(int cIndex)
        Return the internal ByteBuf on the specified index. Note that updating the indexes of the returned buffer will lead to an undefined behavior of this buffer.
        Parameters:
        cIndex - the index for which the ByteBuf should be returned
      • internalComponentAtOffset

        public ByteBuf internalComponentAtOffset​(int offset)
        Return the internal ByteBuf on the specified offset. Note that updating the indexes of the returned buffer will lead to an undefined behavior of this buffer.
        Parameters:
        offset - the offset for which the ByteBuf should be returned
      • internalNioBuffer

        public java.nio.ByteBuffer internalNioBuffer​(int index,
                                                     int length)
        Description copied from class: ByteBuf
        Internal use only: Exposes the internal NIO buffer.
        Specified by:
        internalNioBuffer in class ByteBuf
      • nioBuffer

        public java.nio.ByteBuffer nioBuffer​(int index,
                                             int length)
        Description copied from class: ByteBuf
        Exposes this buffer's sub-region as an NIO ByteBuffer. 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.
        Specified by:
        nioBuffer in class ByteBuf
        See Also:
        ByteBuf.nioBufferCount(), ByteBuf.nioBuffers(), ByteBuf.nioBuffers(int, int)
      • nioBuffers

        public java.nio.ByteBuffer[] nioBuffers​(int index,
                                                int length)
        Description copied from class: ByteBuf
        Exposes this buffer's bytes as an NIO ByteBuffer's for the specified index and length 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.
        Specified by:
        nioBuffers in class ByteBuf
        See Also:
        ByteBuf.nioBufferCount(), ByteBuf.nioBuffer(), ByteBuf.nioBuffer(int, int)
      • consolidate

        public CompositeByteBuf consolidate​(int cIndex,
                                            int numComponents)
        Consolidate the composed ByteBufs
        Parameters:
        cIndex - the index on which to start to compose
        numComponents - the number of components to compose
      • discardReadBytes

        public CompositeByteBuf discardReadBytes()
        Description copied from class: ByteBuf
        Discards the bytes between the 0th index and readerIndex. It moves the bytes between readerIndex and writerIndex to the 0th index, and sets readerIndex and writerIndex to 0 and oldWriterIndex - oldReaderIndex respectively.

        Please refer to the class documentation for more detailed explanation.

        Overrides:
        discardReadBytes in class AbstractByteBuf
      • setIndex

        public CompositeByteBuf setIndex​(int readerIndex,
                                         int writerIndex)
        Description copied from class: ByteBuf
        Sets the readerIndex and writerIndex of this buffer in one shot. This method is useful when you have to worry about the invocation order of ByteBuf.readerIndex(int) and ByteBuf.writerIndex(int) methods. For example, the following code will fail:
         // Create a buffer whose readerIndex, writerIndex and capacity are
         // 0, 0 and 8 respectively.
         ByteBuf buf = Unpooled.buffer(8);
        
         // IndexOutOfBoundsException is thrown because the specified
         // readerIndex (2) cannot be greater than the current writerIndex (0).
         buf.readerIndex(2);
         buf.writerIndex(4);
         
        The following code will also fail:
         // Create a buffer whose readerIndex, writerIndex and capacity are
         // 0, 8 and 8 respectively.
         ByteBuf buf = Unpooled.wrappedBuffer(new byte[8]);
        
         // readerIndex becomes 8.
         buf.readLong();
        
         // IndexOutOfBoundsException is thrown because the specified
         // writerIndex (4) cannot be less than the current readerIndex (8).
         buf.writerIndex(4);
         buf.readerIndex(2);
         
        By contrast, this method guarantees that it never throws an IndexOutOfBoundsException as long as the specified indexes meet basic constraints, regardless what the current index values of the buffer are:
         // No matter what the current state of the buffer is, the following
         // call always succeeds as long as the capacity of the buffer is not
         // less than 4.
         buf.setIndex(2, 4);
         
        Overrides:
        setIndex in class AbstractByteBuf
      • clear

        public CompositeByteBuf clear()
        Description copied from class: ByteBuf
        Sets the readerIndex and writerIndex of this buffer to 0. This method is identical to setIndex(0, 0).

        Please note that the behavior of this method is different from that of NIO buffer, which sets the limit to the capacity of the buffer.

        Overrides:
        clear in class AbstractByteBuf
      • getBytes

        public CompositeByteBuf getBytes​(int index,
                                         byte[] dst)
        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 AbstractByteBuf
      • setBoolean

        public CompositeByteBuf setBoolean​(int index,
                                           boolean value)
        Description copied from class: ByteBuf
        Sets the specified boolean at the specified absolute index in this buffer. This method does not modify readerIndex or writerIndex of this buffer.
        Overrides:
        setBoolean in class AbstractByteBuf
      • setChar

        public CompositeByteBuf setChar​(int index,
                                        int value)
        Description copied from class: ByteBuf
        Sets the specified 2-byte UTF-16 character 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.
        Overrides:
        setChar in class AbstractByteBuf
      • setFloat

        public CompositeByteBuf setFloat​(int index,
                                         float value)
        Description copied from class: ByteBuf
        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.
        Overrides:
        setFloat in class AbstractByteBuf
      • setDouble

        public CompositeByteBuf setDouble​(int index,
                                          double value)
        Description copied from class: ByteBuf
        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.
        Overrides:
        setDouble in class AbstractByteBuf
      • setBytes

        public CompositeByteBuf setBytes​(int index,
                                         byte[] src)
        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.
        Overrides:
        setBytes in class AbstractByteBuf
      • setZero

        public CompositeByteBuf 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
      • readBytes

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

        public CompositeByteBuf readBytes​(byte[] dst)
        Description copied from class: ByteBuf
        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).
        Overrides:
        readBytes in class AbstractByteBuf
      • readBytes

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

        public CompositeByteBuf readBytes​(java.nio.ByteBuffer dst)
        Description copied from class: ByteBuf
        Transfers this buffer's data to the specified destination starting at the current readerIndex until the destination's position reaches its limit, and increases the readerIndex by the number of the transferred bytes.
        Overrides:
        readBytes in class AbstractByteBuf
      • readBytes

        public CompositeByteBuf readBytes​(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 current readerIndex.
        Overrides:
        readBytes in class AbstractByteBuf
        length - the number of bytes to transfer
        Throws:
        java.io.IOException - if the specified stream threw an exception during I/O
      • writeBoolean

        public CompositeByteBuf writeBoolean​(boolean value)
        Description copied from class: ByteBuf
        Sets the specified boolean at the current writerIndex and increases the writerIndex by 1 in this buffer. If this.writableBytes is less than 1, ByteBuf.ensureWritable(int) will be called in an attempt to expand capacity to accommodate.
        Overrides:
        writeBoolean in class AbstractByteBuf
      • writeByte

        public CompositeByteBuf writeByte​(int value)
        Description copied from class: ByteBuf
        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. If this.writableBytes is less than 1, ByteBuf.ensureWritable(int) will be called in an attempt to expand capacity to accommodate.
        Overrides:
        writeByte in class AbstractByteBuf
      • writeShort

        public CompositeByteBuf writeShort​(int value)
        Description copied from class: ByteBuf
        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. If this.writableBytes is less than 2, ByteBuf.ensureWritable(int) will be called in an attempt to expand capacity to accommodate.
        Overrides:
        writeShort in class AbstractByteBuf
      • writeMedium

        public CompositeByteBuf writeMedium​(int value)
        Description copied from class: ByteBuf
        Sets the specified 24-bit medium integer at the current writerIndex and increases the writerIndex by 3 in this buffer. If this.writableBytes is less than 3, ByteBuf.ensureWritable(int) will be called in an attempt to expand capacity to accommodate.
        Overrides:
        writeMedium in class AbstractByteBuf
      • writeInt

        public CompositeByteBuf writeInt​(int value)
        Description copied from class: ByteBuf
        Sets the specified 32-bit integer at the current writerIndex and increases the writerIndex by 4 in this buffer. If this.writableBytes is less than 4, ByteBuf.ensureWritable(int) will be called in an attempt to expand capacity to accommodate.
        Overrides:
        writeInt in class AbstractByteBuf
      • writeLong

        public CompositeByteBuf writeLong​(long value)
        Description copied from class: ByteBuf
        Sets the specified 64-bit long integer at the current writerIndex and increases the writerIndex by 8 in this buffer. If this.writableBytes is less than 8, ByteBuf.ensureWritable(int) will be called in an attempt to expand capacity to accommodate.
        Overrides:
        writeLong in class AbstractByteBuf
      • writeChar

        public CompositeByteBuf writeChar​(int value)
        Description copied from class: ByteBuf
        Sets the specified 2-byte UTF-16 character at the current writerIndex and increases the writerIndex by 2 in this buffer. The 16 high-order bits of the specified value are ignored. If this.writableBytes is less than 2, ByteBuf.ensureWritable(int) will be called in an attempt to expand capacity to accommodate.
        Overrides:
        writeChar in class AbstractByteBuf
      • writeFloat

        public CompositeByteBuf writeFloat​(float value)
        Description copied from class: ByteBuf
        Sets the specified 32-bit floating point number at the current writerIndex and increases the writerIndex by 4 in this buffer. If this.writableBytes is less than 4, ByteBuf.ensureWritable(int) will be called in an attempt to expand capacity to accommodate.
        Overrides:
        writeFloat in class AbstractByteBuf
      • writeDouble

        public CompositeByteBuf writeDouble​(double value)
        Description copied from class: ByteBuf
        Sets the specified 64-bit floating point number at the current writerIndex and increases the writerIndex by 8 in this buffer. If this.writableBytes is less than 8, ByteBuf.ensureWritable(int) will be called in an attempt to expand capacity to accommodate.
        Overrides:
        writeDouble in class AbstractByteBuf
      • writeBytes

        public CompositeByteBuf writeBytes​(ByteBuf src,
                                           int srcIndex,
                                           int length)
        Description copied from class: ByteBuf
        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). If this.writableBytes is less than length, ByteBuf.ensureWritable(int) will be called in an attempt to expand capacity to accommodate.
        Overrides:
        writeBytes in class AbstractByteBuf
        srcIndex - the first index of the source
        length - the number of bytes to transfer
      • writeBytes

        public CompositeByteBuf writeBytes​(byte[] src)
        Description copied from class: ByteBuf
        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). If this.writableBytes is less than src.length, ByteBuf.ensureWritable(int) will be called in an attempt to expand capacity to accommodate.
        Overrides:
        writeBytes in class AbstractByteBuf
      • writeBytes

        public CompositeByteBuf writeBytes​(byte[] src,
                                           int srcIndex,
                                           int length)
        Description copied from class: ByteBuf
        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). If this.writableBytes is less than length, ByteBuf.ensureWritable(int) will be called in an attempt to expand capacity to accommodate.
        Overrides:
        writeBytes in class AbstractByteBuf
        srcIndex - the first index of the source
        length - the number of bytes to transfer
      • writeBytes

        public CompositeByteBuf writeBytes​(java.nio.ByteBuffer src)
        Description copied from class: ByteBuf
        Transfers the specified source buffer's data to this buffer starting at the current writerIndex until the source buffer's position reaches its limit, and increases the writerIndex by the number of the transferred bytes. If this.writableBytes is less than src.remaining(), ByteBuf.ensureWritable(int) will be called in an attempt to expand capacity to accommodate.
        Overrides:
        writeBytes in class AbstractByteBuf
      • writeZero

        public CompositeByteBuf 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
      • nioBuffers

        public java.nio.ByteBuffer[] nioBuffers()
        Description copied from class: ByteBuf
        Exposes this buffer's readable bytes 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.
        Overrides:
        nioBuffers in class AbstractByteBuf
        See Also:
        ByteBuf.nioBufferCount(), ByteBuf.nioBuffer(), ByteBuf.nioBuffer(int, int)
      • discardSomeReadBytes

        public CompositeByteBuf discardSomeReadBytes()
        Description copied from class: ByteBuf
        Similar to ByteBuf.discardReadBytes() except that this method might discard some, all, or none of read bytes depending on its internal implementation to reduce overall memory bandwidth consumption at the cost of potentially additional memory consumption.
        Overrides:
        discardSomeReadBytes in class AbstractByteBuf
      • unwrap

        public ByteBuf unwrap()
        Description copied from class: ByteBuf
        Return the underlying buffer instance if this buffer is a wrapper of another buffer.
        Specified by:
        unwrap in class ByteBuf
        Returns:
        null if this buffer is not a wrapper