Returns the number of bytes (octets) this buffer can contain.
Adjusts the capacity of this buffer. If the {@code newCapacity} is less than the current capacity, the content of this buffer is truncated. If the {@code newCapacity} is greater than the current capacity, the buffer is appended with unspecified data whose length is {@code (newCapacity - currentCapacity)}.
Returns the maximum allowed capacity of this buffer. This value provides an upper bound on {@link #capacity()}.
Returns the {@link ByteBufAllocator} which created this buffer.
Returns the <a href="http://en.wikipedia.org/wiki/Endianness">endianness</a> of this buffer.
Return the underlying buffer instance if this buffer is a wrapper of another buffer.
Returns {@code true} if and only if this buffer is backed by an NIO direct buffer.
Returns {@code true} if and only if this buffer is read-only.
Returns a read-only version of this buffer.
Returns the {@code readerIndex} of this buffer.
Sets the {@code readerIndex} of this buffer.
Returns the {@code writerIndex} of this buffer.
Sets the {@code writerIndex} of this buffer.
Sets the {@code readerIndex} and {@code writerIndex} of this buffer in one shot. This method is useful when you have to worry about the invocation order of {@link #readerIndex(int)} and {@link #writerIndex(int)} methods. For example, the following code will fail:
Returns the number of readable bytes which is equal to {@code (this.writerIndex - this.readerIndex)}.
Returns the number of writable bytes which is equal to {@code (this.capacity - this.writerIndex)}.
Returns the maximum possible number of writable bytes, which is equal to {@code (this.maxCapacity - this.writerIndex)}.
Returns the maximum number of bytes which can be written for certain without involving an internal reallocation or data-copy. The returned value will be ≥ {@link #writableBytes()} and ≤ {@link #maxWritableBytes()}.
Returns {@code true} if and only if {@code (this.writerIndex - this.readerIndex)} is greater than {@code 0}.
Returns {@code true} if and only if this buffer contains equal to or more than the specified number of elements.
Returns {@code true} if and only if {@code (this.capacity - this.writerIndex)} is greater than {@code 0}.
Returns {@code true} if and only if this buffer has enough room to allow writing the specified number of elements.
Sets the {@code readerIndex} and {@code writerIndex} of this buffer to {@code 0}. This method is identical to {@link #setIndex(int, int) setIndex(0, 0)}. <p> Please note that the behavior of this method is different from that of NIO buffer, which sets the {@code limit} to the {@code capacity} of the buffer.
Marks the current {@code readerIndex} in this buffer. You can reposition the current {@code readerIndex} to the marked {@code readerIndex} by calling {@link #resetReaderIndex()}. The initial value of the marked {@code readerIndex} is {@code 0}.
Repositions the current {@code readerIndex} to the marked {@code readerIndex} in this buffer.
Marks the current {@code writerIndex} in this buffer. You can reposition the current {@code writerIndex} to the marked {@code writerIndex} by calling {@link #resetWriterIndex()}. The initial value of the marked {@code writerIndex} is {@code 0}.
Repositions the current {@code writerIndex} to the marked {@code writerIndex} in this buffer.
Discards the bytes between the 0th index and {@code readerIndex}. It moves the bytes between {@code readerIndex} and {@code writerIndex} to the 0th index, and sets {@code readerIndex} and {@code writerIndex} to {@code 0} and {@code oldWriterIndex - oldReaderIndex} respectively. <p> Please refer to the class documentation for more detailed explanation.
Similar to {@link 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.
Expands the buffer {@link #capacity()} to make sure the number of {@linkplain #writableBytes() writable bytes} is equal to or greater than the specified value. If there are enough writable bytes in this buffer, this method returns with no side effect.
Expands the buffer {@link #capacity()} to make sure the number of {@linkplain #writableBytes() writable bytes} is equal to or greater than the specified value. Unlike {@link #ensureWritable(int)}, this method returns a status code.
Gets a bool at the specified absolute (@code index) in this buffer. This method does not modify the {@code readerIndex} or {@code writerIndex} of this buffer.
Gets a byte at the specified absolute {@code index} in this buffer. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets an unsigned byte at the specified absolute {@code index} in this buffer. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets a 16-bit short integer at the specified absolute {@code index} in this buffer. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets a 16-bit short integer at the specified absolute {@code index} in this buffer in Little Endian Byte Order. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets an unsigned 16-bit short integer at the specified absolute {@code index} in this buffer. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets an unsigned 16-bit short integer at the specified absolute {@code index} in this buffer in Little Endian Byte Order. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets a 24-bit medium integer at the specified absolute {@code index} in this buffer. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets a 24-bit medium integer at the specified absolute {@code index} in this buffer in the Little Endian Byte Order. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets an unsigned 24-bit medium integer at the specified absolute {@code index} in this buffer. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets an unsigned 24-bit medium integer at the specified absolute {@code index} in this buffer in Little Endian Byte Order. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets a 32-bit integer at the specified absolute {@code index} in this buffer. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets a 32-bit integer at the specified absolute {@code index} in this buffer with Little Endian Byte Order. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets an unsigned 32-bit integer at the specified absolute {@code index} in this buffer. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets an unsigned 32-bit integer at the specified absolute {@code index} in this buffer in Little Endian Byte Order. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets a 64-bit long integer at the specified absolute {@code index} in this buffer. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets a 64-bit long integer at the specified absolute {@code index} in this buffer in Little Endian Byte Order. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets a 2-byte UTF-16 character at the specified absolute {@code index} in this buffer. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets a 32-bit floating point number at the specified absolute {@code index} in this buffer. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets a 32-bit floating point number at the specified absolute {@code index} in this buffer in Little Endian Byte Order. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets a 64-bit floating point number at the specified absolute {@code index} in this buffer. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets a 64-bit floating point number at the specified absolute {@code index} in this buffer in Little Endian Byte Order. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Transfers this buffer's data to the specified destination starting at the specified absolute {@code index} until the destination becomes non-writable. This method is basically same with {@link #getBytes(int, ByteBuf, int, int)}, except that this method increases the {@code writerIndex} of the destination by the number of the transferred bytes while {@link #getBytes(int, ByteBuf, int, int)} does not. This method does not modify {@code readerIndex} or {@code writerIndex} of the source buffer (i.e. {@code this}).
Transfers this buffer's data to the specified destination starting at the specified absolute {@code index}. This method is basically same with {@link #getBytes(int, ByteBuf, int, int)}, except that this method increases the {@code writerIndex} of the destination by the number of the transferred bytes while {@link #getBytes(int, ByteBuf, int, int)} does not. This method does not modify {@code readerIndex} or {@code writerIndex} of the source buffer (i.e. {@code this}).
Transfers this buffer's data to the specified destination starting at the specified absolute {@code index}. This method does not modify {@code readerIndex} or {@code writerIndex} of both the source (i.e. {@code this}) and the destination.
Transfers this buffer's data to the specified destination starting at the specified absolute {@code index}. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer
Transfers this buffer's data to the specified destination starting at the specified absolute {@code index}. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Transfers this buffer's data to the specified destination starting at the specified absolute {@code index} until the destination's position reaches its limit. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer while the destination's {@code position} will be increased.
Transfers this buffer's data to the specified stream starting at the specified absolute {@code index}. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Gets a {@link CharSequence} with the given length at the given index.
Sets the specified bool at the specified absolute {@code index} in this buffer. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Sets the specified byte at the specified absolute {@code index} in this buffer. The 24 high-order bits of the specified value are ignored. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Sets the specified 16-bit short integer at the specified absolute {@code index} in this buffer. The 16 high-order bits of the specified value are ignored. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Sets the specified 16-bit short integer at the specified absolute {@code 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 {@code readerIndex} or {@code writerIndex} of this buffer.
Sets the specified 24-bit medium integer at the specified absolute {@code index} in this buffer. Please note that the most significant byte is ignored in the specified value. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Sets the specified 24-bit medium integer at the specified absolute {@code index} in this buffer in the Little Endian Byte Order. Please note that the most significant byte is ignored in the specified value. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Sets the specified 32-bit integer at the specified absolute {@code index} in this buffer. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Sets the specified 32-bit integer at the specified absolute {@code index} in this buffer with Little Endian byte order . This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Sets the specified 64-bit long integer at the specified absolute {@code index} in this buffer. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Sets the specified 64-bit long integer at the specified absolute {@code index} in this buffer in Little Endian Byte Order. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Sets the specified 2-byte UTF-16 character at the specified absolute {@code index} in this buffer. The 16 high-order bits of the specified value are ignored. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Sets the specified 32-bit floating-point number at the specified absolute {@code index} in this buffer. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Sets the specified 32-bit floating-point number at the specified absolute {@code index} in this buffer in Little Endian Byte Order. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Sets the specified 64-bit floating-point number at the specified absolute {@code index} in this buffer. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Sets the specified 64-bit floating-point number at the specified absolute {@code index} in this buffer in Little Endian Byte Order. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Transfers the specified source buffer's data to this buffer starting at the specified absolute {@code index} until the source buffer becomes unreadable. This method is basically same with {@link #setBytes(int, ByteBuf, int, int)}, except that this method increases the {@code readerIndex} of the source buffer by the number of the transferred bytes while {@link #setBytes(int, ByteBuf, int, int)} does not. This method does not modify {@code readerIndex} or {@code writerIndex} of the source buffer (i.e. {@code this}).
Transfers the specified source buffer's data to this buffer starting at the specified absolute {@code index}. This method is basically same with {@link #setBytes(int, ByteBuf, int, int)}, except that this method increases the {@code readerIndex} of the source buffer by the number of the transferred bytes while {@link #setBytes(int, ByteBuf, int, int)} does not. This method does not modify {@code readerIndex} or {@code writerIndex} of the source buffer (i.e. {@code this}).
Transfers the specified source buffer's data to this buffer starting at the specified absolute {@code index}. This method does not modify {@code readerIndex} or {@code writerIndex} of both the source (i.e. {@code this}) and the destination.
Transfers the specified source array's data to this buffer starting at the specified absolute {@code index}. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Transfers the specified source array's data to this buffer starting at the specified absolute {@code index}. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Transfers the specified source buffer's data to this buffer starting at the specified absolute {@code index} until the source buffer's position reaches its limit. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Transfers the content of the specified source stream to this buffer starting at the specified absolute {@code index}. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Fills this buffer with <tt>NUL (0x00)</tt> starting at the specified absolute {@code index}. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Writes the specified {@link CharSequence} at the current {@code writerIndex} and increases the {@code writerIndex} by the written bytes.
Gets a bool at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 1} in this buffer.
Gets a byte at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 1} in this buffer.
Gets an unsigned byte at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 1} in this buffer.
Gets a 16-bit short integer at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 2} in this buffer.
Gets a 16-bit short integer at the current {@code readerIndex} in the Little Endian Byte Order and increases the {@code readerIndex} by {@code 2} in this buffer.
Gets an unsigned 16-bit short integer at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 2} in this buffer.
Gets an unsigned 16-bit short integer at the current {@code readerIndex} in the Little Endian Byte Order and increases the {@code readerIndex} by {@code 2} in this buffer.
Gets a 24-bit medium integer at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 3} in this buffer.
Gets a 24-bit medium integer at the current {@code readerIndex} in the Little Endian Byte Order and increases the {@code readerIndex} by {@code 3} in this buffer.
Gets an unsigned 24-bit medium integer at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 3} in this buffer.
Gets an unsigned 24-bit medium integer at the current {@code readerIndex} in the Little Endian Byte Order and increases the {@code readerIndex} by {@code 3} in this buffer.
Gets a 32-bit integer at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 4} in this buffer.
Gets a 32-bit integer at the current {@code readerIndex} in the Little Endian Byte Order and increases the {@code readerIndex} by {@code 4} in this buffer.
Gets an unsigned 32-bit integer at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 4} in this buffer.
Gets an unsigned 32-bit integer at the current {@code readerIndex} in the Little Endian Byte Order and increases the {@code readerIndex} by {@code 4} in this buffer.
Gets a 64-bit integer at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 8} in this buffer.
Gets a 64-bit integer at the current {@code readerIndex} in the Little Endian Byte Order and increases the {@code readerIndex} by {@code 8} in this buffer.
Gets a 2-byte UTF-16 character at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 2} in this buffer.
Gets a 32-bit floating point number at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 4} in this buffer.
Gets a 32-bit floating point number at the current {@code readerIndex} in Little Endian Byte Order and increases the {@code readerIndex} by {@code 4} in this buffer.
Gets a 64-bit floating point number at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 8} in this buffer.
Gets a 64-bit floating point number at the current {@code readerIndex} in Little Endian Byte Order and increases the {@code readerIndex} by {@code 8} in this buffer.
Transfers this buffer's data to a newly created buffer starting at the current {@code readerIndex} and increases the {@code readerIndex} by the number of the transferred bytes (= {@code length}). The returned buffer's {@code readerIndex} and {@code writerIndex} are {@code 0} and {@code length} respectively.
Returns a new slice of this buffer's sub-region starting at the current {@code readerIndex} and increases the {@code readerIndex} by the size of the new slice (= {@code length}). <p> Also be aware that this method will NOT call {@link #retain()} and so the reference count will NOT be increased.
Returns a new retained slice of this buffer's sub-region starting at the current {@code readerIndex} and increases the {@code readerIndex} by the size of the new slice (= {@code length}). <p> Note that this method returns a {@linkplain #retain() retained} buffer unlike {@link #readSlice(int)}. This method behaves similarly to {@code readSlice(...).retain()} except that this method may return a buffer implementation that produces less garbage.
Transfers this buffer's data to the specified destination starting at the current {@code readerIndex} until the destination becomes non-writable, and increases the {@code readerIndex} by the number of the transferred bytes. This method is basically same with {@link #readBytes(ByteBuf, int, int)}, except that this method increases the {@code writerIndex} of the destination by the number of the transferred bytes while {@link #readBytes(ByteBuf, int, int)} does not.
Transfers this buffer's data to the specified destination starting at the current {@code readerIndex} and increases the {@code readerIndex} by the number of the transferred bytes (= {@code length}). This method is basically same with {@link #readBytes(ByteBuf, int, int)}, except that this method increases the {@code writerIndex} of the destination by the number of the transferred bytes (= {@code length}) while {@link #readBytes(ByteBuf, int, int)} does not.
Transfers this buffer's data to the specified destination starting at the current {@code readerIndex} and increases the {@code readerIndex} by the number of the transferred bytes (= {@code length}).
Transfers this buffer's data to the specified destination starting at the current {@code readerIndex} and increases the {@code readerIndex} by the number of the transferred bytes (= {@code dst.length}).
Transfers this buffer's data to the specified destination starting at the current {@code readerIndex} and increases the {@code readerIndex} by the number of the transferred bytes (= {@code length}).
Transfers this buffer's data to the specified destination starting at the current {@code readerIndex} until the destination's position reaches its limit, and increases the {@code readerIndex} by the number of the transferred bytes.
Transfers this buffer's data to the specified stream starting at the current {@code readerIndex}.
Gets a {@link CharSequence} with the given length at the current {@code readerIndex} and increases the {@code readerIndex} by the given length.
Increases the current {@code readerIndex} by the specified {@code length} in this buffer.
Sets the specified bool at the current {@code writerIndex} and increases the {@code writerIndex} by {@code 1} in this buffer. If {@code this.writableBytes} is less than {@code 1}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Sets the specified byte at the current {@code writerIndex} and increases the {@code writerIndex} by {@code 1} in this buffer. The 24 high-order bits of the specified value are ignored. If {@code this.writableBytes} is less than {@code 1}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Sets the specified 16-bit short integer at the current {@code writerIndex} and increases the {@code writerIndex} by {@code 2} in this buffer. The 16 high-order bits of the specified value are ignored. If {@code this.writableBytes} is less than {@code 2}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Sets the specified 16-bit short integer in the Little Endian Byte Order at the current {@code writerIndex} and increases the {@code writerIndex} by {@code 2} in this buffer. The 16 high-order bits of the specified value are ignored. If {@code this.writableBytes} is less than {@code 2}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Sets the specified 24-bit medium integer at the current {@code writerIndex} and increases the {@code writerIndex} by {@code 3} in this buffer. If {@code this.writableBytes} is less than {@code 3}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Sets the specified 24-bit medium integer at the current {@code writerIndex} in the Little Endian Byte Order and increases the {@code writerIndex} by {@code 3} in this buffer. If {@code this.writableBytes} is less than {@code 3}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Sets the specified 32-bit integer at the current {@code writerIndex} and increases the {@code writerIndex} by {@code 4} in this buffer. If {@code this.writableBytes} is less than {@code 4}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Sets the specified 32-bit integer at the current {@code writerIndex} in the Little Endian Byte Order and increases the {@code writerIndex} by {@code 4} in this buffer. If {@code this.writableBytes} is less than {@code 4}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Sets the specified 64-bit long integer at the current {@code writerIndex} and increases the {@code writerIndex} by {@code 8} in this buffer. If {@code this.writableBytes} is less than {@code 8}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Sets the specified 64-bit long integer at the current {@code writerIndex} in the Little Endian Byte Order and increases the {@code writerIndex} by {@code 8} in this buffer. If {@code this.writableBytes} is less than {@code 8}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Sets the specified 2-byte UTF-16 character at the current {@code writerIndex} and increases the {@code writerIndex} by {@code 2} in this buffer. The 16 high-order bits of the specified value are ignored. If {@code this.writableBytes} is less than {@code 2}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Sets the specified 32-bit floating point number at the current {@code writerIndex} and increases the {@code writerIndex} by {@code 4} in this buffer. If {@code this.writableBytes} is less than {@code 4}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Sets the specified 32-bit floating point number at the current {@code writerIndex} in Little Endian Byte Order and increases the {@code writerIndex} by {@code 4} in this buffer. If {@code this.writableBytes} is less than {@code 4}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Sets the specified 64-bit floating point number at the current {@code writerIndex} and increases the {@code writerIndex} by {@code 8} in this buffer. If {@code this.writableBytes} is less than {@code 8}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Sets the specified 64-bit floating point number at the current {@code writerIndex} in Little Endian Byte Order and increases the {@code writerIndex} by {@code 8} in this buffer. If {@code this.writableBytes} is less than {@code 8}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Transfers the specified source buffer's data to this buffer starting at the current {@code writerIndex} until the source buffer becomes unreadable, and increases the {@code writerIndex} by the number of the transferred bytes. This method is basically same with {@link #writeBytes(ByteBuf, int, int)}, except that this method increases the {@code readerIndex} of the source buffer by the number of the transferred bytes while {@link #writeBytes(ByteBuf, int, int)} does not. If {@code this.writableBytes} is less than {@code src.readableBytes}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Transfers the specified source buffer's data to this buffer starting at the current {@code writerIndex} and increases the {@code writerIndex} by the number of the transferred bytes (= {@code length}). This method is basically same with {@link #writeBytes(ByteBuf, int, int)}, except that this method increases the {@code readerIndex} of the source buffer by the number of the transferred bytes (= {@code length}) while {@link #writeBytes(ByteBuf, int, int)} does not. If {@code this.writableBytes} is less than {@code length}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Transfers the specified source buffer's data to this buffer starting at the current {@code writerIndex} and increases the {@code writerIndex} by the number of the transferred bytes (= {@code length}). If {@code this.writableBytes} is less than {@code length}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Transfers the specified source array's data to this buffer starting at the current {@code writerIndex} and increases the {@code writerIndex} by the number of the transferred bytes (= {@code src.length}). If {@code this.writableBytes} is less than {@code src.length}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Transfers the specified source array's data to this buffer starting at the current {@code writerIndex} and increases the {@code writerIndex} by the number of the transferred bytes (= {@code length}). If {@code this.writableBytes} is less than {@code length}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Transfers the specified source buffer's data to this buffer starting at the current {@code writerIndex} until the source buffer's position reaches its limit, and increases the {@code writerIndex} by the number of the transferred bytes. If {@code this.writableBytes} is less than {@code src.remaining()}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Transfers the content of the specified stream to this buffer starting at the current {@code writerIndex} and increases the {@code writerIndex} by the number of the transferred bytes. If {@code this.writableBytes} is less than {@code length}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Fills this buffer with <tt>NUL (0x00)</tt> starting at the current {@code writerIndex} and increases the {@code writerIndex} by the specified {@code length}. If {@code this.writableBytes} is less than {@code length}, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Writes the specified {@link CharSequence} at the current {@code writerIndex} and increases the {@code writerIndex} by the written bytes. in this buffer. If {@code this.writableBytes} is not large enough to write the whole sequence, {@link #ensureWritable(int)} will be called in an attempt to expand capacity to accommodate.
Locates the first occurrence of the specified {@code value} in this buffer. The search takes place from the specified {@code fromIndex} (inclusive) to the specified {@code toIndex} (exclusive). <p> If {@code fromIndex} is greater than {@code toIndex}, the search is performed in a reversed order. <p> This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Locates the first occurrence of the specified {@code value} in this buffer. The search takes place from the current {@code readerIndex} (inclusive) to the current {@code writerIndex} (exclusive). <p> This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Locates the first occurrence of the specified {@code value} in this buffer. The search starts from the current {@code readerIndex} (inclusive) and lasts for the specified {@code length}. <p> This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Locates the first occurrence of the specified {@code value} in this buffer. The search starts from the specified {@code index} (inclusive) and lasts for the specified {@code length}. <p> This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Iterates over the readable bytes of this buffer with the specified {@code processor} in ascending order.
Iterates over the specified area of this buffer with the specified {@code processor} in ascending order. (i.e. {@code index}, {@code (index + 1)}, .. {@code (index + length - 1)})
Iterates over the readable bytes of this buffer with the specified {@code processor} in descending order.
Iterates over the specified area of this buffer with the specified {@code processor} in descending order. (i.e. {@code (index + length - 1)}, {@code (index + length - 2)}, ... {@code index})
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 {@code buf.copy(buf.readerIndex(), buf.readableBytes())}. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
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 {@code readerIndex} or {@code writerIndex} of this buffer.
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 {@code buf.slice(buf.readerIndex(), buf.readableBytes())}. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer. <p> Also be aware that this method will NOT call {@link #retain()} and so the reference count will NOT be increased.
Returns a retained 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 {@code buf.slice(buf.readerIndex(), buf.readableBytes())}. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer. <p> Note that this method returns a {@linkplain #retain() retained} buffer unlike {@link #slice()}. This method behaves similarly to {@code slice().retain()} except that this method may return a buffer implementation that produces less garbage.
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 {@code readerIndex} or {@code writerIndex} of this buffer. <p> Also be aware that this method will NOT call {@link #retain()} and so the reference count will NOT be increased.
Returns a retained 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 {@code readerIndex} or {@code writerIndex} of this buffer. <p> Note that this method returns a {@linkplain #retain() retained} buffer unlike {@link #slice(int, int)}. This method behaves similarly to {@code slice(...).retain()} except that this method may return a buffer implementation that produces less garbage.
Returns a buffer which shares the whole region of this buffer. 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 {@code readerIndex} or {@code writerIndex} of this buffer. <p> The reader and writer marks will not be duplicated. Also be aware that this method will NOT call {@link #retain()} and so the reference count will NOT be increased. @return A buffer whose readable content is equivalent to the buffer returned by {@link #slice()}. However this buffer will share the capacity of the underlying buffer, and therefore allows access to all of the underlying content if necessary.
Returns a retained buffer which shares the whole region of this buffer. 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 {@code buf.slice(0, buf.capacity())}. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer. <p> Note that this method returns a {@linkplain #retain() retained} buffer unlike {@link #slice(int, int)}. This method behaves similarly to {@code duplicate().retain()} except that this method may return a buffer implementation that produces less garbage.
Returns the maximum number of NIO {@link ByteBuffer}s that consist this buffer. Note that {@link #nioBuffers()} or {@link #nioBuffers(int, int)} might return a less number of {@link ByteBuffer}s.
Exposes this buffer's readable bytes as an NIO {@link 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 is identical to {@code buf.nioBuffer(buf.readerIndex(), buf.readableBytes())}. This method does not modify {@code readerIndex} or {@code 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.
Exposes this buffer's sub-region as an NIO {@link 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 {@code readerIndex} or {@code 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.
Internal use only: Exposes the internal NIO buffer.
Exposes this buffer's readable bytes as an NIO {@link 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 {@code readerIndex} or {@code 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.
Exposes this buffer's bytes as an NIO {@link 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 {@code readerIndex} or {@code 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.
Returns {@code true} if and only if this buffer has a backing byte array. If this method returns true, you can safely call {@link #array()} and {@link #arrayOffset()}.
Returns the backing byte array of this buffer.
Returns the offset of the first byte within the backing byte array of this buffer.
Returns {@code true} if and only if this buffer has a reference to the low-level memory address that points to the backing data.
Returns the low-level memory address that point to the first byte of ths backing data.
Decodes this buffer's readable bytes into a string with the specified character set name. This method is identical to {@code buf.toString(buf.readerIndex(), buf.readableBytes(), charsetName)}. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Decodes this buffer's sub-region into a string with the specified character set. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.
Returns a hash code which was calculated from the content of this buffer. If there's a byte array which is {@linkplain #equals(Object) equal to} this array, both arrays should return the same value.
Determines if the content of the specified buffer is identical to the content of this array. 'Identical' here means: <ul> <li>the size of the contents of the two buffers are same and</li> <li>every single byte of the content of the two buffers are same.</li> </ul> Please note that it does not compare {@link #readerIndex()} nor {@link #writerIndex()}. This method also returns {@code false} for {@code null} and an object which is not an instance of {@link ByteBuf} type.
Compares the content of the specified buffer to the content of this buffer. Comparison is performed in the same manner with the string comparison functions of various languages such as {@code strcmp}, {@code memcmp} and {@link string#compareTo(string)}.
Returns the string representation of this buffer. This method does not necessarily return the whole content of the buffer but returns the values of the key properties such as {@link #readerIndex()}, {@link #writerIndex()} and {@link #capacity()}.
Used internally by {@link AbstractByteBuf#ensureAccessible()} to try to guard against using the buffer after it was released (best-effort).
An empty {@link ByteBuf} whose capacity and maximum capacity are all {@code 0}.