AbstractByteBuf

A skeletal implementation of a buffer.

abstract
class AbstractByteBuf : ByteBuf {}

Constructors

this
this(int maxCapacity)
Undocumented in source.

Members

Aliases

copy
alias copy = ByteBuf.copy
Undocumented in source.
getBytes
alias getBytes = ByteBuf.getBytes
Undocumented in source.
nioBuffer
alias nioBuffer = ByteBuf.nioBuffer
Undocumented in source.
nioBuffers
alias nioBuffers = ByteBuf.nioBuffers
Undocumented in source.
setBytes
alias setBytes = ByteBuf.setBytes
Undocumented in source.

Functions

_getByte
byte _getByte(int index)
Undocumented in source.
_getInt
int _getInt(int index)
Undocumented in source.
_getIntLE
int _getIntLE(int index)
Undocumented in source.
_getLong
long _getLong(int index)
Undocumented in source.
_getLongLE
long _getLongLE(int index)
Undocumented in source.
_getShort
short _getShort(int index)
Undocumented in source.
_getShortLE
short _getShortLE(int index)
Undocumented in source.
_getUnsignedMedium
int _getUnsignedMedium(int index)
Undocumented in source.
_getUnsignedMediumLE
int _getUnsignedMediumLE(int index)
Undocumented in source.
_setByte
void _setByte(int index, int value)
Undocumented in source.
_setInt
void _setInt(int index, int value)
Undocumented in source.
_setIntLE
void _setIntLE(int index, int value)
Undocumented in source.
_setLong
void _setLong(int index, long value)
Undocumented in source.
_setLongLE
void _setLongLE(int index, long value)
Undocumented in source.
_setMedium
void _setMedium(int index, int value)
Undocumented in source.
_setMediumLE
void _setMediumLE(int index, int value)
Undocumented in source.
_setShort
void _setShort(int index, int value)
Undocumented in source.
_setShortLE
void _setShortLE(int index, int value)
Undocumented in source.
adjustMarkers
void adjustMarkers(int decrement)
Undocumented in source. Be warned that the author may not have intended to support it.
asReadOnly
ByteBuf asReadOnly()
Undocumented in source. Be warned that the author may not have intended to support it.
bytesBefore
int bytesBefore(int index, int length, byte value)
Undocumented in source. Be warned that the author may not have intended to support it.
bytesBefore
int bytesBefore(int length, byte value)
Undocumented in source. Be warned that the author may not have intended to support it.
bytesBefore
int bytesBefore(byte value)
Undocumented in source. Be warned that the author may not have intended to support it.
checkDstIndex
void checkDstIndex(int length, int dstIndex, int dstCapacity)
Undocumented in source. Be warned that the author may not have intended to support it.
checkDstIndex
void checkDstIndex(int index, int length, int dstIndex, int dstCapacity)
Undocumented in source. Be warned that the author may not have intended to support it.
checkIndex
void checkIndex(int index, int fieldLength)
Undocumented in source. Be warned that the author may not have intended to support it.
checkIndex
void checkIndex(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
checkIndex0
void checkIndex0(int index, int fieldLength)
Undocumented in source. Be warned that the author may not have intended to support it.
checkNewCapacity
void checkNewCapacity(int newCapacity)
Undocumented in source. Be warned that the author may not have intended to support it.
checkReadableBytes
void checkReadableBytes(int minimumReadableBytes)

{@link IndexOutOfBoundsException} if the current {@linkplain #readableBytes() readable bytes} of this buffer is less than the specified value.

checkSrcIndex
void checkSrcIndex(int index, int length, int srcIndex, int srcCapacity)
Undocumented in source. Be warned that the author may not have intended to support it.
clear
ByteBuf clear()
Undocumented in source. Be warned that the author may not have intended to support it.
compareTo
int compareTo(ByteBuf that)
Undocumented in source. Be warned that the author may not have intended to support it.
copy
ByteBuf copy()
Undocumented in source. Be warned that the author may not have intended to support it.
discardMarks
void discardMarks()
Undocumented in source. Be warned that the author may not have intended to support it.
discardReadBytes
ByteBuf discardReadBytes()
Undocumented in source. Be warned that the author may not have intended to support it.
discardSomeReadBytes
ByteBuf discardSomeReadBytes()
Undocumented in source. Be warned that the author may not have intended to support it.
duplicate
ByteBuf duplicate()
Undocumented in source. Be warned that the author may not have intended to support it.
ensureAccessible
void ensureAccessible()

Should be called by every method that tries to access the buffers content to check if the buffer was released before.

ensureWritable
ByteBuf ensureWritable(int minWritableBytes)
Undocumented in source. Be warned that the author may not have intended to support it.
ensureWritable
int ensureWritable(int minWritableBytes, bool force)
Undocumented in source. Be warned that the author may not have intended to support it.
ensureWritable0
void ensureWritable0(int minWritableBytes)
Undocumented in source. Be warned that the author may not have intended to support it.
forEachByte
int forEachByte(int index, int length, ByteProcessor processor)
Undocumented in source. Be warned that the author may not have intended to support it.
forEachByte
int forEachByte(ByteProcessor processor)
Undocumented in source. Be warned that the author may not have intended to support it.
forEachByteAsc0
int forEachByteAsc0(int start, int end, ByteProcessor processor)
Undocumented in source. Be warned that the author may not have intended to support it.
forEachByteDesc
int forEachByteDesc(int index, int length, ByteProcessor processor)
Undocumented in source. Be warned that the author may not have intended to support it.
forEachByteDesc
int forEachByteDesc(ByteProcessor processor)
Undocumented in source. Be warned that the author may not have intended to support it.
forEachByteDesc0
int forEachByteDesc0(int rStart, int rEnd, ByteProcessor processor)
Undocumented in source. Be warned that the author may not have intended to support it.
getBoolean
bool getBoolean(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
getByte
byte getByte(int index)

Creates a new {@link SwappedByteBuf} for this {@link ByteBuf} instance.

getBytes
ByteBuf getBytes(int index, byte[] dst)
Undocumented in source. Be warned that the author may not have intended to support it.
getBytes
ByteBuf getBytes(int index, ByteBuf dst)
Undocumented in source. Be warned that the author may not have intended to support it.
getBytes
ByteBuf getBytes(int index, ByteBuf dst, int length)
Undocumented in source. Be warned that the author may not have intended to support it.
getChar
char getChar(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
getCharSequence
string getCharSequence(int index, int length, Charset charset)
Undocumented in source. Be warned that the author may not have intended to support it.
getDouble
double getDouble(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
getFloat
float getFloat(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
getInt
int getInt(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
getIntLE
int getIntLE(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
getLong
long getLong(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
getLongLE
long getLongLE(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
getMedium
int getMedium(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
getMediumLE
int getMediumLE(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
getReadableBytes
byte[] getReadableBytes()
Undocumented in source. Be warned that the author may not have intended to support it.
getShort
short getShort(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
getShortLE
short getShortLE(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
getUnsignedByte
short getUnsignedByte(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
getUnsignedInt
long getUnsignedInt(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
getUnsignedIntLE
long getUnsignedIntLE(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
getUnsignedMedium
int getUnsignedMedium(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
getUnsignedMediumLE
int getUnsignedMediumLE(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
getUnsignedShort
int getUnsignedShort(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
getUnsignedShortLE
int getUnsignedShortLE(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
indexOf
int indexOf(int fromIndex, int toIndex, byte value)
Undocumented in source. Be warned that the author may not have intended to support it.
isReadOnly
bool isReadOnly()
Undocumented in source. Be warned that the author may not have intended to support it.
isReadable
bool isReadable()
Undocumented in source. Be warned that the author may not have intended to support it.
isReadable
bool isReadable(int numBytes)
Undocumented in source. Be warned that the author may not have intended to support it.
isWritable
bool isWritable()
Undocumented in source. Be warned that the author may not have intended to support it.
isWritable
bool isWritable(int numBytes)
Undocumented in source. Be warned that the author may not have intended to support it.
markReaderIndex
ByteBuf markReaderIndex()
Undocumented in source. Be warned that the author may not have intended to support it.
markWriterIndex
ByteBuf markWriterIndex()
Undocumented in source. Be warned that the author may not have intended to support it.
maxCapacity
int maxCapacity()
Undocumented in source. Be warned that the author may not have intended to support it.
maxCapacity
void maxCapacity(int v)
Undocumented in source. Be warned that the author may not have intended to support it.
maxWritableBytes
int maxWritableBytes()
Undocumented in source. Be warned that the author may not have intended to support it.
nioBuffer
ByteBuffer nioBuffer()
Undocumented in source. Be warned that the author may not have intended to support it.
nioBuffers
ByteBuffer[] nioBuffers()
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(Object o)
Undocumented in source. Be warned that the author may not have intended to support it.
readBoolean
bool readBoolean()
Undocumented in source. Be warned that the author may not have intended to support it.
readByte
byte readByte()
Undocumented in source. Be warned that the author may not have intended to support it.
readBytes
ByteBuf readBytes(int length)
Undocumented in source. Be warned that the author may not have intended to support it.
readBytes
ByteBuf readBytes(byte[] dst, int dstIndex, int length)
Undocumented in source. Be warned that the author may not have intended to support it.
readBytes
ByteBuf readBytes(byte[] dst)
Undocumented in source. Be warned that the author may not have intended to support it.
readBytes
ByteBuf readBytes(ByteBuf dst)
Undocumented in source. Be warned that the author may not have intended to support it.
readBytes
ByteBuf readBytes(ByteBuf dst, int length)
Undocumented in source. Be warned that the author may not have intended to support it.
readBytes
ByteBuf readBytes(ByteBuf dst, int dstIndex, int length)
Undocumented in source. Be warned that the author may not have intended to support it.
readBytes
ByteBuf readBytes(ByteBuffer dst)
Undocumented in source. Be warned that the author may not have intended to support it.
readBytes
ByteBuf readBytes(OutputStream outStream, int length)
Undocumented in source. Be warned that the author may not have intended to support it.
readChar
char readChar()
Undocumented in source. Be warned that the author may not have intended to support it.
readCharSequence
string readCharSequence(int length, Charset charset)
Undocumented in source. Be warned that the author may not have intended to support it.
readDouble
double readDouble()
Undocumented in source. Be warned that the author may not have intended to support it.
readFloat
float readFloat()
Undocumented in source. Be warned that the author may not have intended to support it.
readInt
int readInt()
Undocumented in source. Be warned that the author may not have intended to support it.
readIntLE
int readIntLE()
Undocumented in source. Be warned that the author may not have intended to support it.
readLong
long readLong()
Undocumented in source. Be warned that the author may not have intended to support it.
readLongLE
long readLongLE()
Undocumented in source. Be warned that the author may not have intended to support it.
readMedium
int readMedium()
Undocumented in source. Be warned that the author may not have intended to support it.
readMediumLE
int readMediumLE()
Undocumented in source. Be warned that the author may not have intended to support it.
readRetainedSlice
ByteBuf readRetainedSlice(int length)
Undocumented in source. Be warned that the author may not have intended to support it.
readShort
short readShort()
Undocumented in source. Be warned that the author may not have intended to support it.
readShortLE
short readShortLE()
Undocumented in source. Be warned that the author may not have intended to support it.
readSlice
ByteBuf readSlice(int length)
Undocumented in source. Be warned that the author may not have intended to support it.
readUnsignedByte
short readUnsignedByte()
Undocumented in source. Be warned that the author may not have intended to support it.
readUnsignedInt
long readUnsignedInt()
Undocumented in source. Be warned that the author may not have intended to support it.
readUnsignedIntLE
long readUnsignedIntLE()
Undocumented in source. Be warned that the author may not have intended to support it.
readUnsignedMedium
int readUnsignedMedium()
Undocumented in source. Be warned that the author may not have intended to support it.
readUnsignedMediumLE
int readUnsignedMediumLE()
Undocumented in source. Be warned that the author may not have intended to support it.
readUnsignedShort
int readUnsignedShort()
Undocumented in source. Be warned that the author may not have intended to support it.
readUnsignedShortLE
int readUnsignedShortLE()
Undocumented in source. Be warned that the author may not have intended to support it.
readableBytes
int readableBytes()
Undocumented in source. Be warned that the author may not have intended to support it.
readerIndex
ByteBuf readerIndex(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
readerIndex
int readerIndex()
Undocumented in source. Be warned that the author may not have intended to support it.
resetReaderIndex
ByteBuf resetReaderIndex()
Undocumented in source. Be warned that the author may not have intended to support it.
resetWriterIndex
ByteBuf resetWriterIndex()
Undocumented in source. Be warned that the author may not have intended to support it.
retainedDuplicate
ByteBuf retainedDuplicate()
Undocumented in source. Be warned that the author may not have intended to support it.
retainedSlice
ByteBuf retainedSlice()
Undocumented in source. Be warned that the author may not have intended to support it.
retainedSlice
ByteBuf retainedSlice(int index, int length)
Undocumented in source. Be warned that the author may not have intended to support it.
setBoolean
ByteBuf setBoolean(int index, bool value)
Undocumented in source. Be warned that the author may not have intended to support it.
setByte
ByteBuf setByte(int index, int value)
Undocumented in source. Be warned that the author may not have intended to support it.
setBytes
ByteBuf setBytes(int index, ByteBuf src, int length)
Undocumented in source. Be warned that the author may not have intended to support it.
setBytes
ByteBuf setBytes(int index, ByteBuf src)
Undocumented in source. Be warned that the author may not have intended to support it.
setBytes
ByteBuf setBytes(int index, byte[] src)
Undocumented in source. Be warned that the author may not have intended to support it.
setChar
ByteBuf setChar(int index, int value)
Undocumented in source. Be warned that the author may not have intended to support it.
setCharSequence
int setCharSequence(int index, CharSequence sequence, Charset charset)
Undocumented in source. Be warned that the author may not have intended to support it.
setDouble
ByteBuf setDouble(int index, double value)
Undocumented in source. Be warned that the author may not have intended to support it.
setFloat
ByteBuf setFloat(int index, float value)
Undocumented in source. Be warned that the author may not have intended to support it.
setIndex
ByteBuf setIndex(int rIndex, int wIndex)
Undocumented in source. Be warned that the author may not have intended to support it.
setIndex0
void setIndex0(int rIndex, int wIndex)
Undocumented in source. Be warned that the author may not have intended to support it.
setInt
ByteBuf setInt(int index, int value)
Undocumented in source. Be warned that the author may not have intended to support it.
setIntLE
ByteBuf setIntLE(int index, int value)
Undocumented in source. Be warned that the author may not have intended to support it.
setLong
ByteBuf setLong(int index, long value)
Undocumented in source. Be warned that the author may not have intended to support it.
setLongLE
ByteBuf setLongLE(int index, long value)
Undocumented in source. Be warned that the author may not have intended to support it.
setMedium
ByteBuf setMedium(int index, int value)
Undocumented in source. Be warned that the author may not have intended to support it.
setMediumLE
ByteBuf setMediumLE(int index, int value)
Undocumented in source. Be warned that the author may not have intended to support it.
setShort
ByteBuf setShort(int index, int value)
Undocumented in source. Be warned that the author may not have intended to support it.
setShortLE
ByteBuf setShortLE(int index, int value)
Undocumented in source. Be warned that the author may not have intended to support it.
setZero
ByteBuf setZero(int index, int length)
Undocumented in source. Be warned that the author may not have intended to support it.
skipBytes
ByteBuf skipBytes(int length)
Undocumented in source. Be warned that the author may not have intended to support it.
slice
ByteBuf slice()
Undocumented in source. Be warned that the author may not have intended to support it.
slice
ByteBuf slice(int index, int length)
Undocumented in source. Be warned that the author may not have intended to support it.
toHash
size_t toHash()
Undocumented in source. Be warned that the author may not have intended to support it.
toString
string toString(Charset charset)
Undocumented in source. Be warned that the author may not have intended to support it.
toString
string toString(int index, int length, Charset charset)
Undocumented in source. Be warned that the author may not have intended to support it.
toString
string toString()
Undocumented in source. Be warned that the author may not have intended to support it.
writableBytes
int writableBytes()
Undocumented in source. Be warned that the author may not have intended to support it.
writeBoolean
ByteBuf writeBoolean(bool value)
Undocumented in source. Be warned that the author may not have intended to support it.
writeByte
ByteBuf writeByte(int value)
Undocumented in source. Be warned that the author may not have intended to support it.
writeBytes
ByteBuf writeBytes(byte[] src, int srcIndex, int length)
Undocumented in source. Be warned that the author may not have intended to support it.
writeBytes
ByteBuf writeBytes(byte[] src)
Undocumented in source. Be warned that the author may not have intended to support it.
writeBytes
ByteBuf writeBytes(ByteBuf src)
Undocumented in source. Be warned that the author may not have intended to support it.
writeBytes
ByteBuf writeBytes(ByteBuf src, int length)
Undocumented in source. Be warned that the author may not have intended to support it.
writeBytes
ByteBuf writeBytes(ByteBuf src, int srcIndex, int length)
Undocumented in source. Be warned that the author may not have intended to support it.
writeBytes
ByteBuf writeBytes(ByteBuffer src)
Undocumented in source. Be warned that the author may not have intended to support it.
writeBytes
int writeBytes(InputStream inStream, int length)
Undocumented in source. Be warned that the author may not have intended to support it.
writeChar
ByteBuf writeChar(int value)
Undocumented in source. Be warned that the author may not have intended to support it.
writeCharSequence
int writeCharSequence(CharSequence sequence, Charset charset)
Undocumented in source. Be warned that the author may not have intended to support it.
writeDouble
ByteBuf writeDouble(double value)
Undocumented in source. Be warned that the author may not have intended to support it.
writeFloat
ByteBuf writeFloat(float value)
Undocumented in source. Be warned that the author may not have intended to support it.
writeInt
ByteBuf writeInt(int value)
Undocumented in source. Be warned that the author may not have intended to support it.
writeIntLE
ByteBuf writeIntLE(int value)
Undocumented in source. Be warned that the author may not have intended to support it.
writeLong
ByteBuf writeLong(long value)
Undocumented in source. Be warned that the author may not have intended to support it.
writeLongLE
ByteBuf writeLongLE(long value)
Undocumented in source. Be warned that the author may not have intended to support it.
writeMedium
ByteBuf writeMedium(int value)
Undocumented in source. Be warned that the author may not have intended to support it.
writeMediumLE
ByteBuf writeMediumLE(int value)
Undocumented in source. Be warned that the author may not have intended to support it.
writeShort
ByteBuf writeShort(int value)
Undocumented in source. Be warned that the author may not have intended to support it.
writeShortLE
ByteBuf writeShortLE(int value)
Undocumented in source. Be warned that the author may not have intended to support it.
writeZero
ByteBuf writeZero(int length)
Undocumented in source. Be warned that the author may not have intended to support it.
writerIndex
ByteBuf writerIndex(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
writerIndex
int writerIndex()
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

_readerIndex
int _readerIndex;
Undocumented in source.
_writerIndex
int _writerIndex;
Undocumented in source.
checkAccessible
enum bool checkAccessible;
Undocumented in source.

Inherited Members

From ByteBuf

capacity
int capacity()

Returns the number of bytes (octets) this buffer can contain.

capacity
ByteBuf capacity(int newCapacity)

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)}.

maxCapacity
int maxCapacity()

Returns the maximum allowed capacity of this buffer. This value provides an upper bound on {@link #capacity()}.

alloc
ByteBufAllocator alloc()

Returns the {@link ByteBufAllocator} which created this buffer.

order
ByteOrder order()

Returns the <a href="http://en.wikipedia.org/wiki/Endianness">endianness</a> of this buffer.

unwrap
ByteBuf unwrap()

Return the underlying buffer instance if this buffer is a wrapper of another buffer.

isDirect
bool isDirect()

Returns {@code true} if and only if this buffer is backed by an NIO direct buffer.

isReadOnly
bool isReadOnly()

Returns {@code true} if and only if this buffer is read-only.

asReadOnly
ByteBuf asReadOnly()

Returns a read-only version of this buffer.

readerIndex
int readerIndex()

Returns the {@code readerIndex} of this buffer.

readerIndex
ByteBuf readerIndex(int readerIndex)

Sets the {@code readerIndex} of this buffer.

writerIndex
int writerIndex()

Returns the {@code writerIndex} of this buffer.

writerIndex
ByteBuf writerIndex(int writerIndex)

Sets the {@code writerIndex} of this buffer.

setIndex
ByteBuf setIndex(int readerIndex, int writerIndex)

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:

readableBytes
int readableBytes()

Returns the number of readable bytes which is equal to {@code (this.writerIndex - this.readerIndex)}.

writableBytes
int writableBytes()

Returns the number of writable bytes which is equal to {@code (this.capacity - this.writerIndex)}.

maxWritableBytes
int maxWritableBytes()

Returns the maximum possible number of writable bytes, which is equal to {@code (this.maxCapacity - this.writerIndex)}.

maxFastWritableBytes
int maxFastWritableBytes()

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 &ge; {@link #writableBytes()} and &le; {@link #maxWritableBytes()}.

isReadable
bool isReadable()

Returns {@code true} if and only if {@code (this.writerIndex - this.readerIndex)} is greater than {@code 0}.

isReadable
bool isReadable(int size)

Returns {@code true} if and only if this buffer contains equal to or more than the specified number of elements.

isWritable
bool isWritable()

Returns {@code true} if and only if {@code (this.capacity - this.writerIndex)} is greater than {@code 0}.

isWritable
bool isWritable(int size)

Returns {@code true} if and only if this buffer has enough room to allow writing the specified number of elements.

clear
ByteBuf clear()

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.

markReaderIndex
ByteBuf markReaderIndex()

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}.

resetReaderIndex
ByteBuf resetReaderIndex()

Repositions the current {@code readerIndex} to the marked {@code readerIndex} in this buffer.

markWriterIndex
ByteBuf markWriterIndex()

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}.

resetWriterIndex
ByteBuf resetWriterIndex()

Repositions the current {@code writerIndex} to the marked {@code writerIndex} in this buffer.

discardReadBytes
ByteBuf discardReadBytes()

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.

discardSomeReadBytes
ByteBuf discardSomeReadBytes()

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.

ensureWritable
ByteBuf ensureWritable(int minWritableBytes)

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.

ensureWritable
int ensureWritable(int minWritableBytes, bool force)

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.

getBoolean
bool getBoolean(int index)

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.

getByte
byte getByte(int index)

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.

getUnsignedByte
short getUnsignedByte(int index)

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.

getShort
short getShort(int index)

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.

getShortLE
short getShortLE(int index)

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.

getUnsignedShort
int getUnsignedShort(int index)

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.

getUnsignedShortLE
int getUnsignedShortLE(int index)

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.

getMedium
int getMedium(int index)

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.

getMediumLE
int getMediumLE(int index)

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.

getUnsignedMedium
int getUnsignedMedium(int index)

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.

getUnsignedMediumLE
int getUnsignedMediumLE(int index)

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.

getInt
int getInt(int index)

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.

getIntLE
int getIntLE(int index)

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.

getUnsignedInt
long getUnsignedInt(int index)

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.

getUnsignedIntLE
long getUnsignedIntLE(int index)

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.

getLong
long getLong(int index)

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.

getLongLE
long getLongLE(int index)

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.

getChar
char getChar(int index)

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.

getFloat
float getFloat(int index)

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.

getFloatLE
float getFloatLE(int index)

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.

getDouble
double getDouble(int index)

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.

getDoubleLE
double getDoubleLE(int index)

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.

getBytes
ByteBuf getBytes(int index, ByteBuf dst)

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}).

getBytes
ByteBuf getBytes(int index, ByteBuf dst, int length)

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}).

getBytes
ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length)

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.

getBytes
ByteBuf getBytes(int index, byte[] dst)

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

getBytes
ByteBuf getBytes(int index, byte[] dst, int dstIndex, int length)

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.

getBytes
ByteBuf getBytes(int index, ByteBuffer dst)

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.

getBytes
ByteBuf getBytes(int index, OutputStream outStream, int length)

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.

getCharSequence
CharSequence getCharSequence(int index, int length, Charset charset)

Gets a {@link CharSequence} with the given length at the given index.

setBoolean
ByteBuf setBoolean(int index, bool value)

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.

setByte
ByteBuf setByte(int index, int value)

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.

setShort
ByteBuf setShort(int index, int value)

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.

setShortLE
ByteBuf setShortLE(int index, int value)

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.

setMedium
ByteBuf setMedium(int index, int value)

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.

setMediumLE
ByteBuf setMediumLE(int index, int value)

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.

setInt
ByteBuf setInt(int index, int value)

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.

setIntLE
ByteBuf setIntLE(int index, int value)

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.

setLong
ByteBuf setLong(int index, long value)

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.

setLongLE
ByteBuf setLongLE(int index, long value)

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.

setChar
ByteBuf setChar(int index, int value)

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.

setFloat
ByteBuf setFloat(int index, float value)

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.

setFloatLE
ByteBuf setFloatLE(int index, float value)

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.

setDouble
ByteBuf setDouble(int index, double value)

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.

setDoubleLE
ByteBuf setDoubleLE(int index, double value)

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.

setBytes
ByteBuf setBytes(int index, ByteBuf src)

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}).

setBytes
ByteBuf setBytes(int index, ByteBuf src, int length)

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}).

setBytes
ByteBuf setBytes(int index, ByteBuf src, int srcIndex, int length)

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.

setBytes
ByteBuf setBytes(int index, byte[] src)

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.

setBytes
ByteBuf setBytes(int index, byte[] src, int srcIndex, int length)

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.

setBytes
ByteBuf setBytes(int index, ByteBuffer src)

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.

setBytes
int setBytes(int index, InputStream inStream, int length)

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.

setZero
ByteBuf setZero(int index, int length)

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.

setCharSequence
int setCharSequence(int index, CharSequence sequence, Charset charset)

Writes the specified {@link CharSequence} at the current {@code writerIndex} and increases the {@code writerIndex} by the written bytes.

readBoolean
bool readBoolean()

Gets a bool at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 1} in this buffer.

readByte
byte readByte()

Gets a byte at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 1} in this buffer.

readUnsignedByte
short readUnsignedByte()

Gets an unsigned byte at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 1} in this buffer.

readShort
short readShort()

Gets a 16-bit short integer at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 2} in this buffer.

readShortLE
short readShortLE()

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.

readUnsignedShort
int readUnsignedShort()

Gets an unsigned 16-bit short integer at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 2} in this buffer.

readUnsignedShortLE
int readUnsignedShortLE()

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.

readMedium
int readMedium()

Gets a 24-bit medium integer at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 3} in this buffer.

readMediumLE
int readMediumLE()

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.

readUnsignedMedium
int readUnsignedMedium()

Gets an unsigned 24-bit medium integer at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 3} in this buffer.

readUnsignedMediumLE
int readUnsignedMediumLE()

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.

readInt
int readInt()

Gets a 32-bit integer at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 4} in this buffer.

readIntLE
int readIntLE()

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.

readUnsignedInt
long readUnsignedInt()

Gets an unsigned 32-bit integer at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 4} in this buffer.

readUnsignedIntLE
long readUnsignedIntLE()

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.

readLong
long readLong()

Gets a 64-bit integer at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 8} in this buffer.

readLongLE
long readLongLE()

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.

readChar
char readChar()

Gets a 2-byte UTF-16 character at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 2} in this buffer.

readFloat
float readFloat()

Gets a 32-bit floating point number at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 4} in this buffer.

readFloatLE
float readFloatLE()

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.

readDouble
double readDouble()

Gets a 64-bit floating point number at the current {@code readerIndex} and increases the {@code readerIndex} by {@code 8} in this buffer.

readDoubleLE
double readDoubleLE()

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.

readBytes
ByteBuf readBytes(int length)

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.

readSlice
ByteBuf readSlice(int length)

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.

readRetainedSlice
ByteBuf readRetainedSlice(int length)

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.

readBytes
ByteBuf readBytes(ByteBuf dst)

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.

readBytes
ByteBuf readBytes(ByteBuf dst, int 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}). 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.

readBytes
ByteBuf readBytes(ByteBuf dst, int dstIndex, int 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}).

readBytes
ByteBuf readBytes(byte[] dst)

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}).

readBytes
ByteBuf readBytes(byte[] dst, int dstIndex, int 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}).

readBytes
ByteBuf readBytes(ByteBuffer dst)

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.

readBytes
ByteBuf readBytes(OutputStream outStream, int length)

Transfers this buffer's data to the specified stream starting at the current {@code readerIndex}.

readCharSequence
CharSequence readCharSequence(int length, Charset charset)

Gets a {@link CharSequence} with the given length at the current {@code readerIndex} and increases the {@code readerIndex} by the given length.

skipBytes
ByteBuf skipBytes(int length)

Increases the current {@code readerIndex} by the specified {@code length} in this buffer.

writeBoolean
ByteBuf writeBoolean(bool value)

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.

writeByte
ByteBuf writeByte(int value)

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.

writeShort
ByteBuf writeShort(int value)

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.

writeShortLE
ByteBuf writeShortLE(int value)

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.

writeMedium
ByteBuf writeMedium(int value)

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.

writeMediumLE
ByteBuf writeMediumLE(int value)

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.

writeInt
ByteBuf writeInt(int value)

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.

writeIntLE
ByteBuf writeIntLE(int value)

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.

writeLong
ByteBuf writeLong(long value)

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.

writeLongLE
ByteBuf writeLongLE(long value)

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.

writeChar
ByteBuf writeChar(int value)

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.

writeFloat
ByteBuf writeFloat(float value)

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.

writeFloatLE
ByteBuf writeFloatLE(float value)

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.

writeDouble
ByteBuf writeDouble(double value)

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.

writeDoubleLE
ByteBuf writeDoubleLE(double value)

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.

writeBytes
ByteBuf writeBytes(ByteBuf src)

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.

writeBytes
ByteBuf writeBytes(ByteBuf src, int length)

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.

writeBytes
ByteBuf writeBytes(ByteBuf src, int srcIndex, int length)

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.

writeBytes
ByteBuf writeBytes(byte[] src)

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.

writeBytes
ByteBuf writeBytes(byte[] src, int srcIndex, int length)

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.

writeBytes
ByteBuf writeBytes(ByteBuffer src)

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.

writeBytes
int writeBytes(InputStream inStream, int length)

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.

writeZero
ByteBuf writeZero(int length)

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.

writeCharSequence
int writeCharSequence(CharSequence sequence, Charset charset)

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.

indexOf
int indexOf(int fromIndex, int toIndex, byte value)

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.

bytesBefore
int bytesBefore(byte value)

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.

bytesBefore
int bytesBefore(int length, byte value)

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.

bytesBefore
int bytesBefore(int index, int length, byte value)

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.

forEachByte
int forEachByte(ByteProcessor processor)

Iterates over the readable bytes of this buffer with the specified {@code processor} in ascending order.

forEachByte
int forEachByte(int index, int length, ByteProcessor processor)

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)})

forEachByteDesc
int forEachByteDesc(ByteProcessor processor)

Iterates over the readable bytes of this buffer with the specified {@code processor} in descending order.

forEachByteDesc
int forEachByteDesc(int index, int length, ByteProcessor processor)

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})

copy
ByteBuf copy()

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.

copy
ByteBuf copy(int index, int length)

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.

slice
ByteBuf slice()

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.

retainedSlice
ByteBuf retainedSlice()

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.

slice
ByteBuf slice(int index, int length)

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.

retainedSlice
ByteBuf retainedSlice(int index, int length)

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.

duplicate
ByteBuf duplicate()

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.

retainedDuplicate
ByteBuf retainedDuplicate()

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.

nioBufferCount
int nioBufferCount()

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.

nioBuffer
ByteBuffer nioBuffer()

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.

nioBuffer
ByteBuffer nioBuffer(int index, int length)

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.

internalNioBuffer
ByteBuffer internalNioBuffer(int index, int length)

Internal use only: Exposes the internal NIO buffer.

nioBuffers
ByteBuffer[] nioBuffers()

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.

nioBuffers
ByteBuffer[] nioBuffers(int index, int length)

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.

hasArray
bool hasArray()

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()}.

array
byte[] array()

Returns the backing byte array of this buffer.

getReadableBytes
byte[] getReadableBytes()
Undocumented in source.
arrayOffset
int arrayOffset()

Returns the offset of the first byte within the backing byte array of this buffer.

hasMemoryAddress
bool hasMemoryAddress()

Returns {@code true} if and only if this buffer has a reference to the low-level memory address that points to the backing data.

memoryAddress
long memoryAddress()

Returns the low-level memory address that point to the first byte of ths backing data.

toString
string toString(Charset charset)

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.

toString
string toString(int index, int length, Charset charset)

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.

toHash
size_t toHash()

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.

opEquals
bool opEquals(Object obj)

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.

compareTo
int compareTo(ByteBuf buffer)

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)}.

toString
string toString()

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()}.

retain
ByteBuf retain(int increment)
Undocumented in source.
retain
ByteBuf retain()
Undocumented in source.
touch
ByteBuf touch()
Undocumented in source.
touch
ByteBuf touch(Object hint)
Undocumented in source.
isAccessible
bool isAccessible()

Used internally by {@link AbstractByteBuf#ensureAccessible()} to try to guard against using the buffer after it was released (best-effort).

Meta