public class CompositeByteBuf extends AbstractReferenceCountedByteBuf implements Iterable<ByteBuf>
ByteBufAllocator.compositeBuffer() or Unpooled.wrappedBuffer(ByteBuf...) instead of calling the
constructor explicitly.| Constructor and Description |
|---|
CompositeByteBuf(ByteBufAllocator alloc,
boolean direct,
int maxNumComponents) |
CompositeByteBuf(ByteBufAllocator alloc,
boolean direct,
int maxNumComponents,
ByteBuf... buffers) |
CompositeByteBuf(ByteBufAllocator alloc,
boolean direct,
int maxNumComponents,
Iterable<ByteBuf> buffers) |
| Modifier and Type | Method and Description |
|---|---|
protected byte |
_getByte(int index) |
protected int |
_getInt(int index) |
protected int |
_getIntLE(int index) |
protected long |
_getLong(int index) |
protected long |
_getLongLE(int index) |
protected short |
_getShort(int index) |
protected short |
_getShortLE(int index) |
protected int |
_getUnsignedMedium(int index) |
protected int |
_getUnsignedMediumLE(int index) |
protected void |
_setByte(int index,
int value) |
protected void |
_setInt(int index,
int value) |
protected void |
_setIntLE(int index,
int value) |
protected void |
_setLong(int index,
long value) |
protected void |
_setLongLE(int index,
long value) |
protected void |
_setMedium(int index,
int value) |
protected void |
_setMediumLE(int index,
int value) |
protected void |
_setShort(int index,
int value) |
protected void |
_setShortLE(int index,
int value) |
CompositeByteBuf |
addComponent(boolean increaseWriterIndex,
ByteBuf buffer)
|
CompositeByteBuf |
addComponent(boolean increaseWriterIndex,
int cIndex,
ByteBuf buffer)
Add the given
ByteBuf on the specific index and increase the writerIndex
if increaseWriterIndex is true. |
CompositeByteBuf |
addComponent(ByteBuf buffer)
Add the given
ByteBuf. |
CompositeByteBuf |
addComponent(int cIndex,
ByteBuf buffer)
Add the given
ByteBuf on the specific index. |
CompositeByteBuf |
addComponents(boolean increaseWriterIndex,
ByteBuf... buffers)
|
CompositeByteBuf |
addComponents(boolean increaseWriterIndex,
Iterable<ByteBuf> buffers)
|
CompositeByteBuf |
addComponents(ByteBuf... buffers)
Add the given
ByteBufs. |
CompositeByteBuf |
addComponents(int cIndex,
ByteBuf... buffers)
Add the given
ByteBufs on the specific index
Be aware that this method does not increase the writerIndex of the CompositeByteBuf. |
CompositeByteBuf |
addComponents(int cIndex,
Iterable<ByteBuf> buffers)
Add the given
ByteBufs on the specific index
Be aware that this method does not increase the writerIndex of the CompositeByteBuf. |
CompositeByteBuf |
addComponents(Iterable<ByteBuf> buffers)
Add the given
ByteBufs. |
ByteBufAllocator |
alloc()
Returns the
ByteBufAllocator which created this buffer. |
byte[] |
array()
Returns the backing byte array of this buffer.
|
int |
arrayOffset()
Returns the offset of the first byte within the backing byte array of
this buffer.
|
int |
capacity()
Returns the number of bytes (octets) this buffer can contain.
|
CompositeByteBuf |
capacity(int newCapacity)
Adjusts the capacity of this buffer.
|
CompositeByteBuf |
clear()
Sets the
readerIndex and writerIndex of this buffer to
0. |
ByteBuf |
component(int cIndex)
Return the
ByteBuf on the specified index |
ByteBuf |
componentAtOffset(int offset)
Return the
ByteBuf on the specified index |
CompositeByteBuf |
consolidate()
Consolidate the composed
ByteBufs |
CompositeByteBuf |
consolidate(int cIndex,
int numComponents)
Consolidate the composed
ByteBufs |
ByteBuf |
copy(int index,
int length)
Returns a copy of this buffer's sub-region.
|
protected void |
deallocate()
Called once
AbstractReferenceCountedByteBuf.refCnt() is equals 0. |
List<ByteBuf> |
decompose(int offset,
int length)
Same with
AbstractByteBuf.slice(int, int) except that this method returns a list. |
CompositeByteBuf |
discardReadBytes()
Discards the bytes between the 0th index and
readerIndex. |
CompositeByteBuf |
discardReadComponents()
Discard all
ByteBufs which are read. |
CompositeByteBuf |
discardSomeReadBytes()
Similar to
ByteBuf.discardReadBytes() except that this method might discard
some, all, or none of read bytes depending on its internal implementation to reduce
overall memory bandwidth consumption at the cost of potentially additional memory
consumption. |
CompositeByteBuf |
ensureWritable(int minWritableBytes)
Expands the buffer
ByteBuf.capacity() to make sure the number of
writable bytes is equal to or greater than the
specified value. |
protected int |
forEachByteAsc0(int start,
int end,
io.netty.util.ByteProcessor processor) |
protected int |
forEachByteDesc0(int rStart,
int rEnd,
io.netty.util.ByteProcessor processor) |
byte |
getByte(int index)
Gets a byte at the specified absolute
index in this buffer. |
CompositeByteBuf |
getBytes(int index,
byte[] dst)
Transfers this buffer's data to the specified destination starting at
the specified absolute
index. |
CompositeByteBuf |
getBytes(int index,
byte[] dst,
int dstIndex,
int length)
Transfers this buffer's data to the specified destination starting at
the specified absolute
index. |
CompositeByteBuf |
getBytes(int index,
ByteBuf dst)
Transfers this buffer's data to the specified destination starting at
the specified absolute
index until the destination becomes
non-writable. |
CompositeByteBuf |
getBytes(int index,
ByteBuffer dst)
Transfers this buffer's data to the specified destination starting at
the specified absolute
index until the destination's position
reaches its limit. |
CompositeByteBuf |
getBytes(int index,
ByteBuf dst,
int length)
Transfers this buffer's data to the specified destination starting at
the specified absolute
index. |
CompositeByteBuf |
getBytes(int index,
ByteBuf dst,
int dstIndex,
int length)
Transfers this buffer's data to the specified destination starting at
the specified absolute
index. |
int |
getBytes(int index,
FileChannel out,
long position,
int length)
Transfers this buffer's data starting at the specified absolute
index
to the specified channel starting at the given file position. |
int |
getBytes(int index,
GatheringByteChannel out,
int length)
Transfers this buffer's data to the specified channel starting at the
specified absolute
index. |
CompositeByteBuf |
getBytes(int index,
OutputStream out,
int length)
Transfers this buffer's data to the specified stream starting at the
specified absolute
index. |
boolean |
hasArray()
Returns
true if and only if this buffer has a backing byte array. |
boolean |
hasMemoryAddress()
Returns
true if and only if this buffer has a reference to the low-level memory address that points
to the backing data. |
ByteBuf |
internalComponent(int cIndex)
Return the internal
ByteBuf on the specified index. |
ByteBuf |
internalComponentAtOffset(int offset)
Return the internal
ByteBuf on the specified offset. |
ByteBuffer |
internalNioBuffer(int index,
int length)
Internal use only: Exposes the internal NIO buffer.
|
boolean |
isDirect()
Returns
true if and only if this buffer is backed by an
NIO direct buffer. |
Iterator<ByteBuf> |
iterator() |
CompositeByteBuf |
markReaderIndex()
Marks the current
readerIndex in this buffer. |
CompositeByteBuf |
markWriterIndex()
Marks the current
writerIndex in this buffer. |
int |
maxNumComponents()
Return the max number of
ByteBuf's that are composed in this instance |
long |
memoryAddress()
Returns the low-level memory address that point to the first byte of ths backing data.
|
ByteBuffer |
nioBuffer(int index,
int length)
Exposes this buffer's sub-region as an NIO
ByteBuffer. |
int |
nioBufferCount()
Returns the maximum number of NIO
ByteBuffers that consist this buffer. |
ByteBuffer[] |
nioBuffers()
Exposes this buffer's readable bytes as an NIO
ByteBuffer's. |
ByteBuffer[] |
nioBuffers(int index,
int length)
Exposes this buffer's bytes as an NIO
ByteBuffer's for the specified index and length
The returned buffer either share or contains the copied content of this buffer, while changing
the position and limit of the returned NIO buffer does not affect the indexes and marks of this buffer. |
int |
numComponents()
Return the current number of
ByteBuf's that are composed in this instance |
ByteOrder |
order()
Returns the endianness
of this buffer.
|
CompositeByteBuf |
readBytes(byte[] dst)
Transfers this buffer's data to the specified destination starting at
the current
readerIndex and increases the readerIndex
by the number of the transferred bytes (= dst.length). |
CompositeByteBuf |
readBytes(byte[] dst,
int dstIndex,
int length)
Transfers this buffer's data to the specified destination starting at
the current
readerIndex and increases the readerIndex
by the number of the transferred bytes (= length). |
CompositeByteBuf |
readBytes(ByteBuf dst)
Transfers this buffer's data to the specified destination starting at
the current
readerIndex until the destination becomes
non-writable, and increases the readerIndex by the number of the
transferred bytes. |
CompositeByteBuf |
readBytes(ByteBuffer dst)
Transfers this buffer's data to the specified destination starting at
the current
readerIndex until the destination's position
reaches its limit, and increases the readerIndex by the
number of the transferred bytes. |
CompositeByteBuf |
readBytes(ByteBuf dst,
int length)
Transfers this buffer's data to the specified destination starting at
the current
readerIndex and increases the readerIndex
by the number of the transferred bytes (= length). |
CompositeByteBuf |
readBytes(ByteBuf dst,
int dstIndex,
int length)
Transfers this buffer's data to the specified destination starting at
the current
readerIndex and increases the readerIndex
by the number of the transferred bytes (= length). |
CompositeByteBuf |
readBytes(OutputStream out,
int length)
Transfers this buffer's data to the specified stream starting at the
current
readerIndex. |
CompositeByteBuf |
readerIndex(int readerIndex)
Sets the
readerIndex of this buffer. |
CompositeByteBuf |
removeComponent(int cIndex)
Remove the
ByteBuf from the given index. |
CompositeByteBuf |
removeComponents(int cIndex,
int numComponents)
Remove the number of
ByteBufs starting from the given index. |
CompositeByteBuf |
resetReaderIndex()
Repositions the current
readerIndex to the marked
readerIndex in this buffer. |
CompositeByteBuf |
resetWriterIndex()
Repositions the current
writerIndex to the marked
writerIndex in this buffer. |
CompositeByteBuf |
retain() |
CompositeByteBuf |
retain(int increment) |
CompositeByteBuf |
setBoolean(int index,
boolean value)
Sets the specified boolean at the specified absolute
index in this
buffer. |
CompositeByteBuf |
setByte(int index,
int value)
Sets the specified byte at the specified absolute
index in this
buffer. |
CompositeByteBuf |
setBytes(int index,
byte[] src)
Transfers the specified source array's data to this buffer starting at
the specified absolute
index. |
CompositeByteBuf |
setBytes(int index,
byte[] src,
int srcIndex,
int length)
Transfers the specified source array's data to this buffer starting at
the specified absolute
index. |
CompositeByteBuf |
setBytes(int index,
ByteBuf src)
Transfers the specified source buffer's data to this buffer starting at
the specified absolute
index until the source buffer becomes
unreadable. |
CompositeByteBuf |
setBytes(int index,
ByteBuffer src)
Transfers the specified source buffer's data to this buffer starting at
the specified absolute
index until the source buffer's position
reaches its limit. |
CompositeByteBuf |
setBytes(int index,
ByteBuf src,
int length)
Transfers the specified source buffer's data to this buffer starting at
the specified absolute
index. |
CompositeByteBuf |
setBytes(int index,
ByteBuf src,
int srcIndex,
int length)
Transfers the specified source buffer's data to this buffer starting at
the specified absolute
index. |
int |
setBytes(int index,
FileChannel in,
long position,
int length)
Transfers the content of the specified source channel starting at the given file position
to this buffer starting at the specified absolute
index. |
int |
setBytes(int index,
InputStream in,
int length)
Transfers the content of the specified source stream to this buffer
starting at the specified absolute
index. |
int |
setBytes(int index,
ScatteringByteChannel in,
int length)
Transfers the content of the specified source channel to this buffer
starting at the specified absolute
index. |
CompositeByteBuf |
setChar(int index,
int value)
Sets the specified 2-byte UTF-16 character at the specified absolute
index in this buffer. |
CompositeByteBuf |
setDouble(int index,
double value)
Sets the specified 64-bit floating-point number at the specified
absolute
index in this buffer. |
CompositeByteBuf |
setFloat(int index,
float value)
Sets the specified 32-bit floating-point number at the specified
absolute
index in this buffer. |
CompositeByteBuf |
setIndex(int readerIndex,
int writerIndex)
Sets the
readerIndex and writerIndex of this buffer
in one shot. |
CompositeByteBuf |
setInt(int index,
int value)
Sets the specified 32-bit integer at the specified absolute
index in this buffer. |
CompositeByteBuf |
setLong(int index,
long value)
Sets the specified 64-bit long integer at the specified absolute
index in this buffer. |
CompositeByteBuf |
setMedium(int index,
int value)
Sets the specified 24-bit medium integer at the specified absolute
index in this buffer. |
CompositeByteBuf |
setShort(int index,
int value)
Sets the specified 16-bit short integer at the specified absolute
index in this buffer. |
CompositeByteBuf |
setZero(int index,
int length)
Fills this buffer with NUL (0x00) starting at the specified
absolute
index. |
CompositeByteBuf |
skipBytes(int length)
Increases the current
readerIndex by the specified
length in this buffer. |
int |
toByteIndex(int cIndex) |
int |
toComponentIndex(int offset)
Return the index for the given offset
|
String |
toString()
Returns the string representation of this buffer.
|
CompositeByteBuf |
touch() |
CompositeByteBuf |
touch(Object hint) |
ByteBuf |
unwrap()
Return the underlying buffer instance if this buffer is a wrapper of another buffer.
|
CompositeByteBuf |
writeBoolean(boolean value)
Sets the specified boolean at the current
writerIndex
and increases the writerIndex by 1 in this buffer. |
CompositeByteBuf |
writeByte(int value)
Sets the specified byte at the current
writerIndex
and increases the writerIndex by 1 in this buffer. |
CompositeByteBuf |
writeBytes(byte[] src)
Transfers the specified source array's data to this buffer starting at
the current
writerIndex and increases the writerIndex
by the number of the transferred bytes (= src.length). |
CompositeByteBuf |
writeBytes(byte[] src,
int srcIndex,
int length)
Transfers the specified source array's data to this buffer starting at
the current
writerIndex and increases the writerIndex
by the number of the transferred bytes (= length). |
CompositeByteBuf |
writeBytes(ByteBuf src)
Transfers the specified source buffer's data to this buffer starting at
the current
writerIndex until the source buffer becomes
unreadable, and increases the writerIndex by the number of
the transferred bytes. |
CompositeByteBuf |
writeBytes(ByteBuffer src)
Transfers the specified source buffer's data to this buffer starting at
the current
writerIndex until the source buffer's position
reaches its limit, and increases the writerIndex by the
number of the transferred bytes. |
CompositeByteBuf |
writeBytes(ByteBuf src,
int length)
Transfers the specified source buffer's data to this buffer starting at
the current
writerIndex and increases the writerIndex
by the number of the transferred bytes (= length). |
CompositeByteBuf |
writeBytes(ByteBuf src,
int srcIndex,
int length)
Transfers the specified source buffer's data to this buffer starting at
the current
writerIndex and increases the writerIndex
by the number of the transferred bytes (= length). |
CompositeByteBuf |
writeChar(int value)
Sets the specified 2-byte UTF-16 character at the current
writerIndex and increases the writerIndex by 2
in this buffer. |
CompositeByteBuf |
writeDouble(double value)
Sets the specified 64-bit floating point number at the current
writerIndex and increases the writerIndex by 8
in this buffer. |
CompositeByteBuf |
writeFloat(float value)
Sets the specified 32-bit floating point number at the current
writerIndex and increases the writerIndex by 4
in this buffer. |
CompositeByteBuf |
writeInt(int value)
Sets the specified 32-bit integer at the current
writerIndex
and increases the writerIndex by 4 in this buffer. |
CompositeByteBuf |
writeLong(long value)
Sets the specified 64-bit long integer at the current
writerIndex and increases the writerIndex by 8
in this buffer. |
CompositeByteBuf |
writeMedium(int value)
Sets the specified 24-bit medium integer at the current
writerIndex and increases the writerIndex by 3
in this buffer. |
CompositeByteBuf |
writerIndex(int writerIndex)
Sets the
writerIndex of this buffer. |
CompositeByteBuf |
writeShort(int value)
Sets the specified 16-bit short integer at the current
writerIndex and increases the writerIndex by 2
in this buffer. |
CompositeByteBuf |
writeZero(int length)
Fills this buffer with NUL (0x00) starting at the current
writerIndex and increases the writerIndex by the
specified length. |
refCnt, release, release, setRefCntadjustMarkers, asReadOnly, bytesBefore, bytesBefore, bytesBefore, checkDstIndex, checkIndex, checkIndex, checkNewCapacity, checkReadableBytes, checkSrcIndex, compareTo, copy, duplicate, ensureAccessible, ensureWritable, equals, forEachByte, forEachByte, forEachByteDesc, forEachByteDesc, getBoolean, getChar, getCharSequence, getDouble, getFloat, getInt, getIntLE, getLong, getLongLE, getMedium, getMediumLE, getShort, getShortLE, getUnsignedByte, getUnsignedInt, getUnsignedIntLE, getUnsignedMedium, getUnsignedMediumLE, getUnsignedShort, getUnsignedShortLE, hashCode, indexOf, isReadable, isReadable, isReadOnly, isWritable, isWritable, maxCapacity, maxCapacity, maxWritableBytes, newSwappedByteBuf, nioBuffer, order, readableBytes, readBoolean, readByte, readBytes, readBytes, readBytes, readChar, readCharSequence, readDouble, readerIndex, readFloat, readInt, readIntLE, readLong, readLongLE, readMedium, readMediumLE, readRetainedSlice, readShort, readShortLE, readSlice, readUnsignedByte, readUnsignedInt, readUnsignedIntLE, readUnsignedMedium, readUnsignedMediumLE, readUnsignedShort, readUnsignedShortLE, retainedDuplicate, retainedSlice, retainedSlice, setCharSequence, setIntLE, setLongLE, setMediumLE, setShortLE, slice, slice, toString, toString, writableBytes, writeBytes, writeBytes, writeBytes, writeCharSequence, writeIntLE, writeLongLE, writeMediumLE, writerIndex, writeShortLEgetDoubleLE, getFloatLE, readDoubleLE, readFloatLE, setDoubleLE, setFloatLE, writeDoubleLE, writeFloatLEclone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic CompositeByteBuf(ByteBufAllocator alloc, boolean direct, int maxNumComponents)
public CompositeByteBuf(ByteBufAllocator alloc, boolean direct, int maxNumComponents, ByteBuf... buffers)
public CompositeByteBuf(ByteBufAllocator alloc, boolean direct, int maxNumComponents, Iterable<ByteBuf> buffers)
public CompositeByteBuf addComponent(ByteBuf buffer)
ByteBuf.
Be aware that this method does not increase the writerIndex of the CompositeByteBuf.
If you need to have it increased use addComponent(boolean, ByteBuf).
ReferenceCounted.release() ownership of buffer is transferred to this CompositeByteBuf.
buffer - the ByteBuf to add. ReferenceCounted.release() ownership is transferred to this
CompositeByteBuf.public CompositeByteBuf addComponents(ByteBuf... buffers)
ByteBufs.
Be aware that this method does not increase the writerIndex of the CompositeByteBuf.
If you need to have it increased use addComponents(boolean, ByteBuf[]).
ReferenceCounted.release() ownership of all ByteBuf objects in buffers is transferred to this
CompositeByteBuf.
buffers - the ByteBufs to add. ReferenceCounted.release() ownership of all ReferenceCounted.release()
ownership of all ByteBuf objects is transferred to this CompositeByteBuf.public CompositeByteBuf addComponents(Iterable<ByteBuf> buffers)
ByteBufs.
Be aware that this method does not increase the writerIndex of the CompositeByteBuf.
If you need to have it increased use addComponents(boolean, Iterable).
ReferenceCounted.release() ownership of all ByteBuf objects in buffers is transferred to this
CompositeByteBuf.
buffers - the ByteBufs to add. ReferenceCounted.release() ownership of all ReferenceCounted.release()
ownership of all ByteBuf objects is transferred to this CompositeByteBuf.public CompositeByteBuf addComponent(int cIndex, ByteBuf buffer)
ByteBuf on the specific index.
Be aware that this method does not increase the writerIndex of the CompositeByteBuf.
If you need to have it increased use addComponent(boolean, int, ByteBuf).
ReferenceCounted.release() ownership of buffer is transferred to this CompositeByteBuf.
cIndex - the index on which the ByteBuf will be added.buffer - the ByteBuf to add. ReferenceCounted.release() ownership is transferred to this
CompositeByteBuf.public CompositeByteBuf addComponent(boolean increaseWriterIndex, ByteBuf buffer)
ByteBuf and increase the writerIndex if increaseWriterIndex is
true.
ReferenceCounted.release() ownership of buffer is transferred to this CompositeByteBuf.buffer - the ByteBuf to add. ReferenceCounted.release() ownership is transferred to this
CompositeByteBuf.public CompositeByteBuf addComponents(boolean increaseWriterIndex, ByteBuf... buffers)
ByteBufs and increase the writerIndex if increaseWriterIndex is
true.
ReferenceCounted.release() ownership of all ByteBuf objects in buffers is transferred to this
CompositeByteBuf.buffers - the ByteBufs to add. ReferenceCounted.release() ownership of all ReferenceCounted.release()
ownership of all ByteBuf objects is transferred to this CompositeByteBuf.public CompositeByteBuf addComponents(boolean increaseWriterIndex, Iterable<ByteBuf> buffers)
ByteBufs and increase the writerIndex if increaseWriterIndex is
true.
ReferenceCounted.release() ownership of all ByteBuf objects in buffers is transferred to this
CompositeByteBuf.buffers - the ByteBufs to add. ReferenceCounted.release() ownership of all ReferenceCounted.release()
ownership of all ByteBuf objects is transferred to this CompositeByteBuf.public CompositeByteBuf addComponent(boolean increaseWriterIndex, int cIndex, ByteBuf buffer)
ByteBuf on the specific index and increase the writerIndex
if increaseWriterIndex is true.
ReferenceCounted.release() ownership of buffer is transferred to this CompositeByteBuf.cIndex - the index on which the ByteBuf will be added.buffer - the ByteBuf to add. ReferenceCounted.release() ownership is transferred to this
CompositeByteBuf.public CompositeByteBuf addComponents(int cIndex, ByteBuf... buffers)
ByteBufs on the specific index
Be aware that this method does not increase the writerIndex of the CompositeByteBuf.
If you need to have it increased you need to handle it by your own.
ReferenceCounted.release() ownership of all ByteBuf objects in buffers is transferred to this
CompositeByteBuf.
cIndex - the index on which the ByteBuf will be added. ReferenceCounted.release() ownership of all
ReferenceCounted.release() ownership of all ByteBuf objects is transferred to this
CompositeByteBuf.buffers - the ByteBufs to add. ReferenceCounted.release() ownership of all ReferenceCounted.release()
ownership of all ByteBuf objects is transferred to this CompositeByteBuf.public CompositeByteBuf addComponents(int cIndex, Iterable<ByteBuf> buffers)
ByteBufs on the specific index
Be aware that this method does not increase the writerIndex of the CompositeByteBuf.
If you need to have it increased you need to handle it by your own.
ReferenceCounted.release() ownership of all ByteBuf objects in buffers is transferred to this
CompositeByteBuf.
cIndex - the index on which the ByteBuf will be added.buffers - the ByteBufs to add. ReferenceCounted.release() ownership of all
ReferenceCounted.release() ownership of all ByteBuf objects is transferred to this
CompositeByteBuf.public CompositeByteBuf removeComponent(int cIndex)
ByteBuf from the given index.cIndex - the index on from which the ByteBuf will be removepublic CompositeByteBuf removeComponents(int cIndex, int numComponents)
ByteBufs starting from the given index.cIndex - the index on which the ByteBufs will be started to removednumComponents - the number of components to removeprotected int forEachByteAsc0(int start,
int end,
io.netty.util.ByteProcessor processor)
throws Exception
Exceptionprotected int forEachByteDesc0(int rStart,
int rEnd,
io.netty.util.ByteProcessor processor)
throws Exception
Exceptionpublic List<ByteBuf> decompose(int offset, int length)
AbstractByteBuf.slice(int, int) except that this method returns a list.public boolean isDirect()
ByteBuftrue if and only if this buffer is backed by an
NIO direct buffer.public boolean hasArray()
ByteBuftrue if and only if this buffer has a backing byte array.
If this method returns true, you can safely call ByteBuf.array() and
ByteBuf.arrayOffset().public byte[] array()
ByteBufpublic int arrayOffset()
ByteBufarrayOffset in class ByteBufpublic boolean hasMemoryAddress()
ByteBuftrue if and only if this buffer has a reference to the low-level memory address that points
to the backing data.hasMemoryAddress in class ByteBufpublic long memoryAddress()
ByteBufmemoryAddress in class ByteBufpublic int capacity()
ByteBufpublic CompositeByteBuf capacity(int newCapacity)
ByteBufnewCapacity is less than the current
capacity, the content of this buffer is truncated. If the newCapacity is greater
than the current capacity, the buffer is appended with unspecified data whose length is
(newCapacity - currentCapacity).public ByteBufAllocator alloc()
ByteBufByteBufAllocator which created this buffer.public ByteOrder order()
ByteBufpublic int numComponents()
ByteBuf's that are composed in this instancepublic int maxNumComponents()
ByteBuf's that are composed in this instancepublic int toComponentIndex(int offset)
public int toByteIndex(int cIndex)
public byte getByte(int index)
ByteBufindex in this buffer.
This method does not modify readerIndex or writerIndex of
this buffer.getByte in class AbstractByteBufprotected byte _getByte(int index)
_getByte in class AbstractByteBufprotected short _getShort(int index)
_getShort in class AbstractByteBufprotected short _getShortLE(int index)
_getShortLE in class AbstractByteBufprotected int _getUnsignedMedium(int index)
_getUnsignedMedium in class AbstractByteBufprotected int _getUnsignedMediumLE(int index)
_getUnsignedMediumLE in class AbstractByteBufprotected int _getInt(int index)
_getInt in class AbstractByteBufprotected int _getIntLE(int index)
_getIntLE in class AbstractByteBufprotected long _getLong(int index)
_getLong in class AbstractByteBufprotected long _getLongLE(int index)
_getLongLE in class AbstractByteBufpublic CompositeByteBuf getBytes(int index, byte[] dst, int dstIndex, int length)
ByteBufindex.
This method does not modify readerIndex or writerIndex
of this buffer.public CompositeByteBuf getBytes(int index, ByteBuffer dst)
ByteBufindex until the destination's position
reaches its limit.
This method does not modify readerIndex or writerIndex of
this buffer while the destination's position will be increased.public CompositeByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length)
ByteBufindex.
This method does not modify readerIndex or writerIndex
of both the source (i.e. this) and the destination.public int getBytes(int index,
GatheringByteChannel out,
int length)
throws IOException
ByteBufindex.
This method does not modify readerIndex or writerIndex of
this buffer.getBytes in class ByteBuflength - the maximum number of bytes to transferIOException - if the specified channel threw an exception during I/Opublic int getBytes(int index,
FileChannel out,
long position,
int length)
throws IOException
ByteBufindex
to the specified channel starting at the given file position.
This method does not modify readerIndex or writerIndex of
this buffer. This method does not modify the channel's position.getBytes in class ByteBufposition - the file position at which the transfer is to beginlength - the maximum number of bytes to transferIOException - if the specified channel threw an exception during I/Opublic CompositeByteBuf getBytes(int index, OutputStream out, int length) throws IOException
ByteBufindex.
This method does not modify readerIndex or writerIndex of
this buffer.getBytes in class ByteBuflength - the number of bytes to transferIOException - if the specified stream threw an exception during I/Opublic CompositeByteBuf setByte(int index, int value)
ByteBufindex in this
buffer. The 24 high-order bits of the specified value are ignored.
This method does not modify readerIndex or writerIndex of
this buffer.setByte in class AbstractByteBufprotected void _setByte(int index,
int value)
_setByte in class AbstractByteBufpublic CompositeByteBuf setShort(int index, int value)
ByteBufindex in this buffer. The 16 high-order bits of the specified
value are ignored.
This method does not modify readerIndex or writerIndex of
this buffer.setShort in class AbstractByteBufprotected void _setShort(int index,
int value)
_setShort in class AbstractByteBufprotected void _setShortLE(int index,
int value)
_setShortLE in class AbstractByteBufpublic CompositeByteBuf setMedium(int index, int value)
ByteBufindex in this buffer. Please note that the most significant
byte is ignored in the specified value.
This method does not modify readerIndex or writerIndex of
this buffer.setMedium in class AbstractByteBufprotected void _setMedium(int index,
int value)
_setMedium in class AbstractByteBufprotected void _setMediumLE(int index,
int value)
_setMediumLE in class AbstractByteBufpublic CompositeByteBuf setInt(int index, int value)
ByteBufindex in this buffer.
This method does not modify readerIndex or writerIndex of
this buffer.setInt in class AbstractByteBufprotected void _setInt(int index,
int value)
_setInt in class AbstractByteBufprotected void _setIntLE(int index,
int value)
_setIntLE in class AbstractByteBufpublic CompositeByteBuf setLong(int index, long value)
ByteBufindex in this buffer.
This method does not modify readerIndex or writerIndex of
this buffer.setLong in class AbstractByteBufprotected void _setLong(int index,
long value)
_setLong in class AbstractByteBufprotected void _setLongLE(int index,
long value)
_setLongLE in class AbstractByteBufpublic CompositeByteBuf setBytes(int index, byte[] src, int srcIndex, int length)
ByteBufindex.
This method does not modify readerIndex or writerIndex of
this buffer.public CompositeByteBuf setBytes(int index, ByteBuffer src)
ByteBufindex until the source buffer's position
reaches its limit.
This method does not modify readerIndex or writerIndex of
this buffer.public CompositeByteBuf setBytes(int index, ByteBuf src, int srcIndex, int length)
ByteBufindex.
This method does not modify readerIndex or writerIndex
of both the source (i.e. this) and the destination.public int setBytes(int index,
InputStream in,
int length)
throws IOException
ByteBufindex.
This method does not modify readerIndex or writerIndex of
this buffer.setBytes in class ByteBuflength - the number of bytes to transfer-1 if the specified channel is closed.IOException - if the specified stream threw an exception during I/Opublic int setBytes(int index,
ScatteringByteChannel in,
int length)
throws IOException
ByteBufindex.
This method does not modify readerIndex or writerIndex of
this buffer.setBytes in class ByteBuflength - the maximum number of bytes to transfer-1 if the specified channel is closed.IOException - if the specified channel threw an exception during I/Opublic int setBytes(int index,
FileChannel in,
long position,
int length)
throws IOException
ByteBufindex.
This method does not modify readerIndex or writerIndex of
this buffer. This method does not modify the channel's position.setBytes in class ByteBufposition - the file position at which the transfer is to beginlength - the maximum number of bytes to transfer-1 if the specified channel is closed.IOException - if the specified channel threw an exception during I/Opublic ByteBuf copy(int index, int length)
ByteBufreaderIndex or writerIndex of
this buffer.public ByteBuf componentAtOffset(int offset)
ByteBuf on the specified indexpublic ByteBuf internalComponent(int cIndex)
ByteBuf on the specified index. Note that updating the indexes of the returned
buffer will lead to an undefined behavior of this buffer.cIndex - the index for which the ByteBuf should be returnedpublic ByteBuf internalComponentAtOffset(int offset)
ByteBuf on the specified offset. Note that updating the indexes of the returned
buffer will lead to an undefined behavior of this buffer.offset - the offset for which the ByteBuf should be returnedpublic int nioBufferCount()
ByteBufByteBuffers that consist this buffer. Note that ByteBuf.nioBuffers()
or ByteBuf.nioBuffers(int, int) might return a less number of ByteBuffers.nioBufferCount in class ByteBuf-1 if this buffer has no underlying ByteBuffer.
the number of the underlying ByteBuffers if this buffer has at least one underlying
ByteBuffer. Note that this method does not return 0 to avoid confusion.ByteBuf.nioBuffer(),
ByteBuf.nioBuffer(int, int),
ByteBuf.nioBuffers(),
ByteBuf.nioBuffers(int, int)public ByteBuffer internalNioBuffer(int index, int length)
ByteBufinternalNioBuffer in class ByteBufpublic ByteBuffer nioBuffer(int index, int length)
ByteBufByteBuffer. The returned buffer
either share or contains the copied content of this buffer, while changing the position
and limit of the returned NIO buffer does not affect the indexes and marks of this buffer.
This method does not modify readerIndex or writerIndex of this buffer.
Please note that the returned NIO buffer will not see the changes of this buffer if this buffer
is a dynamic buffer and it adjusted its capacity.nioBuffer in class ByteBufByteBuf.nioBufferCount(),
ByteBuf.nioBuffers(),
ByteBuf.nioBuffers(int, int)public ByteBuffer[] nioBuffers(int index, int length)
ByteBufByteBuffer's for the specified index and length
The returned buffer either share or contains the copied content of this buffer, while changing
the position and limit of the returned NIO buffer does not affect the indexes and marks of this buffer.
This method does not modify readerIndex or writerIndex of this buffer. Please note that the
returned NIO buffer will not see the changes of this buffer if this buffer is a dynamic
buffer and it adjusted its capacity.nioBuffers in class ByteBufByteBuf.nioBufferCount(),
ByteBuf.nioBuffer(),
ByteBuf.nioBuffer(int, int)public CompositeByteBuf consolidate()
ByteBufspublic CompositeByteBuf consolidate(int cIndex, int numComponents)
ByteBufscIndex - the index on which to start to composenumComponents - the number of components to composepublic CompositeByteBuf discardReadComponents()
ByteBufs which are read.public CompositeByteBuf discardReadBytes()
ByteBufreaderIndex.
It moves the bytes between readerIndex and writerIndex
to the 0th index, and sets readerIndex and writerIndex
to 0 and oldWriterIndex - oldReaderIndex respectively.
Please refer to the class documentation for more detailed explanation.
discardReadBytes in class AbstractByteBufpublic String toString()
ByteBufByteBuf.readerIndex(),
ByteBuf.writerIndex() and ByteBuf.capacity().toString in class AbstractByteBufpublic CompositeByteBuf readerIndex(int readerIndex)
ByteBufreaderIndex of this buffer.readerIndex in class AbstractByteBufpublic CompositeByteBuf writerIndex(int writerIndex)
ByteBufwriterIndex of this buffer.writerIndex in class AbstractByteBufpublic CompositeByteBuf setIndex(int readerIndex, int writerIndex)
ByteBufreaderIndex and writerIndex of this buffer
in one shot. This method is useful when you have to worry about the
invocation order of ByteBuf.readerIndex(int) and ByteBuf.writerIndex(int)
methods. For example, the following code will fail:
// Create a buffer whose readerIndex, writerIndex and capacity are // 0, 0 and 8 respectively.The following code will also fail:ByteBufbuf =Unpooled.buffer(8); // IndexOutOfBoundsException is thrown because the specified // readerIndex (2) cannot be greater than the current writerIndex (0). buf.readerIndex(2); buf.writerIndex(4);
// Create a buffer whose readerIndex, writerIndex and capacity are // 0, 8 and 8 respectively.By contrast, this method guarantees that it never throws anByteBufbuf =Unpooled.wrappedBuffer(new byte[8]); // readerIndex becomes 8. buf.readLong(); // IndexOutOfBoundsException is thrown because the specified // writerIndex (4) cannot be less than the current readerIndex (8). buf.writerIndex(4); buf.readerIndex(2);
IndexOutOfBoundsException as long as the specified
indexes meet basic constraints, regardless what the current index
values of the buffer are:
// No matter what the current state of the buffer is, the following // call always succeeds as long as the capacity of the buffer is not // less than 4. buf.setIndex(2, 4);
setIndex in class AbstractByteBufpublic CompositeByteBuf clear()
ByteBufreaderIndex and writerIndex of this buffer to
0.
This method is identical to setIndex(0, 0).
Please note that the behavior of this method is different
from that of NIO buffer, which sets the limit to
the capacity of the buffer.
clear in class AbstractByteBufpublic CompositeByteBuf markReaderIndex()
ByteBufreaderIndex in this buffer. You can
reposition the current readerIndex to the marked
readerIndex by calling ByteBuf.resetReaderIndex().
The initial value of the marked readerIndex is 0.markReaderIndex in class AbstractByteBufpublic CompositeByteBuf resetReaderIndex()
ByteBufreaderIndex to the marked
readerIndex in this buffer.resetReaderIndex in class AbstractByteBufpublic CompositeByteBuf markWriterIndex()
ByteBufwriterIndex in this buffer. You can
reposition the current writerIndex to the marked
writerIndex by calling ByteBuf.resetWriterIndex().
The initial value of the marked writerIndex is 0.markWriterIndex in class AbstractByteBufpublic CompositeByteBuf resetWriterIndex()
ByteBufwriterIndex to the marked
writerIndex in this buffer.resetWriterIndex in class AbstractByteBufpublic CompositeByteBuf ensureWritable(int minWritableBytes)
ByteBufByteBuf.capacity() to make sure the number of
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 in class AbstractByteBufminWritableBytes - the expected minimum number of writable bytesByteBuf.capacity(int)public CompositeByteBuf getBytes(int index, ByteBuf dst)
ByteBufindex until the destination becomes
non-writable. This method is basically same with
ByteBuf.getBytes(int, ByteBuf, int, int), except that this
method increases the writerIndex of the destination by the
number of the transferred bytes while
ByteBuf.getBytes(int, ByteBuf, int, int) does not.
This method does not modify readerIndex or writerIndex of
the source buffer (i.e. this).getBytes in class AbstractByteBufpublic CompositeByteBuf getBytes(int index, ByteBuf dst, int length)
ByteBufindex. This method is basically same
with ByteBuf.getBytes(int, ByteBuf, int, int), except that this
method increases the writerIndex of the destination by the
number of the transferred bytes while
ByteBuf.getBytes(int, ByteBuf, int, int) does not.
This method does not modify readerIndex or writerIndex of
the source buffer (i.e. this).getBytes in class AbstractByteBuflength - the number of bytes to transferpublic CompositeByteBuf getBytes(int index, byte[] dst)
ByteBufindex.
This method does not modify readerIndex or writerIndex of
this buffergetBytes in class AbstractByteBufpublic CompositeByteBuf setBoolean(int index, boolean value)
ByteBufindex in this
buffer.
This method does not modify readerIndex or writerIndex of
this buffer.setBoolean in class AbstractByteBufpublic CompositeByteBuf setChar(int index, int value)
ByteBufindex in this buffer.
The 16 high-order bits of the specified value are ignored.
This method does not modify readerIndex or writerIndex of
this buffer.setChar in class AbstractByteBufpublic CompositeByteBuf setFloat(int index, float value)
ByteBufindex in this buffer.
This method does not modify readerIndex or writerIndex of
this buffer.setFloat in class AbstractByteBufpublic CompositeByteBuf setDouble(int index, double value)
ByteBufindex in this buffer.
This method does not modify readerIndex or writerIndex of
this buffer.setDouble in class AbstractByteBufpublic CompositeByteBuf setBytes(int index, ByteBuf src)
ByteBufindex until the source buffer becomes
unreadable. This method is basically same with
ByteBuf.setBytes(int, ByteBuf, int, int), except that this
method increases the readerIndex of the source buffer by
the number of the transferred bytes while
ByteBuf.setBytes(int, ByteBuf, int, int) does not.
This method does not modify readerIndex or writerIndex of
the source buffer (i.e. this).setBytes in class AbstractByteBufpublic CompositeByteBuf setBytes(int index, ByteBuf src, int length)
ByteBufindex. This method is basically same
with ByteBuf.setBytes(int, ByteBuf, int, int), except that this
method increases the readerIndex of the source buffer by
the number of the transferred bytes while
ByteBuf.setBytes(int, ByteBuf, int, int) does not.
This method does not modify readerIndex or writerIndex of
the source buffer (i.e. this).setBytes in class AbstractByteBuflength - the number of bytes to transferpublic CompositeByteBuf setBytes(int index, byte[] src)
ByteBufindex.
This method does not modify readerIndex or writerIndex of
this buffer.setBytes in class AbstractByteBufpublic CompositeByteBuf setZero(int index, int length)
ByteBufindex.
This method does not modify readerIndex or writerIndex of
this buffer.setZero in class AbstractByteBuflength - the number of NULs to write to the bufferpublic CompositeByteBuf readBytes(ByteBuf dst)
ByteBufreaderIndex until the destination becomes
non-writable, and increases the readerIndex by the number of the
transferred bytes. This method is basically same with
ByteBuf.readBytes(ByteBuf, int, int), except that this method
increases the writerIndex of the destination by the number of
the transferred bytes while ByteBuf.readBytes(ByteBuf, int, int)
does not.readBytes in class AbstractByteBufpublic CompositeByteBuf readBytes(ByteBuf dst, int length)
ByteBufreaderIndex and increases the readerIndex
by the number of the transferred bytes (= length). This method
is basically same with ByteBuf.readBytes(ByteBuf, int, int),
except that this method increases the writerIndex of the
destination by the number of the transferred bytes (= length)
while ByteBuf.readBytes(ByteBuf, int, int) does not.readBytes in class AbstractByteBufpublic CompositeByteBuf readBytes(ByteBuf dst, int dstIndex, int length)
ByteBufreaderIndex and increases the readerIndex
by the number of the transferred bytes (= length).readBytes in class AbstractByteBufdstIndex - the first index of the destinationlength - the number of bytes to transferpublic CompositeByteBuf readBytes(byte[] dst)
ByteBufreaderIndex and increases the readerIndex
by the number of the transferred bytes (= dst.length).readBytes in class AbstractByteBufpublic CompositeByteBuf readBytes(byte[] dst, int dstIndex, int length)
ByteBufreaderIndex and increases the readerIndex
by the number of the transferred bytes (= length).readBytes in class AbstractByteBufdstIndex - the first index of the destinationlength - the number of bytes to transferpublic CompositeByteBuf readBytes(ByteBuffer dst)
ByteBufreaderIndex until the destination's position
reaches its limit, and increases the readerIndex by the
number of the transferred bytes.readBytes in class AbstractByteBufpublic CompositeByteBuf readBytes(OutputStream out, int length) throws IOException
ByteBufreaderIndex.readBytes in class AbstractByteBuflength - the number of bytes to transferIOException - if the specified stream threw an exception during I/Opublic CompositeByteBuf skipBytes(int length)
ByteBufreaderIndex by the specified
length in this buffer.skipBytes in class AbstractByteBufpublic CompositeByteBuf writeBoolean(boolean value)
ByteBufwriterIndex
and increases the writerIndex by 1 in this buffer.
If this.writableBytes is less than 1, ByteBuf.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.writeBoolean in class AbstractByteBufpublic CompositeByteBuf writeByte(int value)
ByteBufwriterIndex
and increases the writerIndex by 1 in this buffer.
The 24 high-order bits of the specified value are ignored.
If this.writableBytes is less than 1, ByteBuf.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.writeByte in class AbstractByteBufpublic CompositeByteBuf writeShort(int value)
ByteBufwriterIndex and increases the writerIndex by 2
in this buffer. The 16 high-order bits of the specified value are ignored.
If this.writableBytes is less than 2, ByteBuf.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.writeShort in class AbstractByteBufpublic CompositeByteBuf writeMedium(int value)
ByteBufwriterIndex and increases the writerIndex by 3
in this buffer.
If this.writableBytes is less than 3, ByteBuf.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.writeMedium in class AbstractByteBufpublic CompositeByteBuf writeInt(int value)
ByteBufwriterIndex
and increases the writerIndex by 4 in this buffer.
If this.writableBytes is less than 4, ByteBuf.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.writeInt in class AbstractByteBufpublic CompositeByteBuf writeLong(long value)
ByteBufwriterIndex and increases the writerIndex by 8
in this buffer.
If this.writableBytes is less than 8, ByteBuf.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.writeLong in class AbstractByteBufpublic CompositeByteBuf writeChar(int value)
ByteBufwriterIndex and increases the writerIndex by 2
in this buffer. The 16 high-order bits of the specified value are ignored.
If this.writableBytes is less than 2, ByteBuf.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.writeChar in class AbstractByteBufpublic CompositeByteBuf writeFloat(float value)
ByteBufwriterIndex and increases the writerIndex by 4
in this buffer.
If this.writableBytes is less than 4, ByteBuf.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.writeFloat in class AbstractByteBufpublic CompositeByteBuf writeDouble(double value)
ByteBufwriterIndex and increases the writerIndex by 8
in this buffer.
If this.writableBytes is less than 8, ByteBuf.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.writeDouble in class AbstractByteBufpublic CompositeByteBuf writeBytes(ByteBuf src)
ByteBufwriterIndex until the source buffer becomes
unreadable, and increases the writerIndex by the number of
the transferred bytes. This method is basically same with
ByteBuf.writeBytes(ByteBuf, int, int), except that this method
increases the readerIndex of the source buffer by the number of
the transferred bytes while ByteBuf.writeBytes(ByteBuf, int, int)
does not.
If this.writableBytes is less than src.readableBytes,
ByteBuf.ensureWritable(int) will be called in an attempt to expand
capacity to accommodate.writeBytes in class AbstractByteBufpublic CompositeByteBuf writeBytes(ByteBuf src, int length)
ByteBufwriterIndex and increases the writerIndex
by the number of the transferred bytes (= length). This method
is basically same with ByteBuf.writeBytes(ByteBuf, int, int),
except that this method increases the readerIndex of the source
buffer by the number of the transferred bytes (= length) while
ByteBuf.writeBytes(ByteBuf, int, int) does not.
If this.writableBytes is less than length, ByteBuf.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.writeBytes in class AbstractByteBuflength - the number of bytes to transferpublic CompositeByteBuf writeBytes(ByteBuf src, int srcIndex, int length)
ByteBufwriterIndex and increases the writerIndex
by the number of the transferred bytes (= length).
If this.writableBytes is less than length, ByteBuf.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.writeBytes in class AbstractByteBufsrcIndex - the first index of the sourcelength - the number of bytes to transferpublic CompositeByteBuf writeBytes(byte[] src)
ByteBufwriterIndex and increases the writerIndex
by the number of the transferred bytes (= src.length).
If this.writableBytes is less than src.length, ByteBuf.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.writeBytes in class AbstractByteBufpublic CompositeByteBuf writeBytes(byte[] src, int srcIndex, int length)
ByteBufwriterIndex and increases the writerIndex
by the number of the transferred bytes (= length).
If this.writableBytes is less than length, ByteBuf.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.writeBytes in class AbstractByteBufsrcIndex - the first index of the sourcelength - the number of bytes to transferpublic CompositeByteBuf writeBytes(ByteBuffer src)
ByteBufwriterIndex until the source buffer's position
reaches its limit, and increases the writerIndex by the
number of the transferred bytes.
If this.writableBytes is less than src.remaining(),
ByteBuf.ensureWritable(int) will be called in an attempt to expand
capacity to accommodate.writeBytes in class AbstractByteBufpublic CompositeByteBuf writeZero(int length)
ByteBufwriterIndex and increases the writerIndex by the
specified length.
If this.writableBytes is less than length, ByteBuf.ensureWritable(int)
will be called in an attempt to expand capacity to accommodate.writeZero in class AbstractByteBuflength - the number of NULs to write to the bufferpublic CompositeByteBuf retain(int increment)
retain in interface io.netty.util.ReferenceCountedretain in class AbstractReferenceCountedByteBufpublic CompositeByteBuf retain()
retain in interface io.netty.util.ReferenceCountedretain in class AbstractReferenceCountedByteBufpublic CompositeByteBuf touch()
touch in interface io.netty.util.ReferenceCountedtouch in class AbstractReferenceCountedByteBufpublic CompositeByteBuf touch(Object hint)
touch in interface io.netty.util.ReferenceCountedtouch in class AbstractReferenceCountedByteBufpublic ByteBuffer[] nioBuffers()
ByteBufByteBuffer's. The returned buffer
either share or contains the copied content of this buffer, while changing the position
and limit of the returned NIO buffer does not affect the indexes and marks of this buffer.
This method does not modify readerIndex or writerIndex of this buffer.
Please note that the returned NIO buffer will not see the changes of this buffer if this buffer
is a dynamic buffer and it adjusted its capacity.nioBuffers in class AbstractByteBufByteBuf.nioBufferCount(),
ByteBuf.nioBuffer(),
ByteBuf.nioBuffer(int, int)public CompositeByteBuf discardSomeReadBytes()
ByteBufByteBuf.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.discardSomeReadBytes in class AbstractByteBufprotected void deallocate()
AbstractReferenceCountedByteBufAbstractReferenceCountedByteBuf.refCnt() is equals 0.deallocate in class AbstractReferenceCountedByteBufCopyright © 2008–2019 The Netty Project. All rights reserved.