@Deprecated public class ReadOnlyByteBuf extends AbstractDerivedByteBuf
Unpooled.unmodifiableBuffer(ByteBuf)
instead of calling the constructor explicitly.Constructor and Description |
---|
ReadOnlyByteBuf(ByteBuf buffer)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected byte |
_getByte(int index)
Deprecated.
|
protected int |
_getInt(int index)
Deprecated.
|
protected int |
_getIntLE(int index)
Deprecated.
|
protected long |
_getLong(int index)
Deprecated.
|
protected long |
_getLongLE(int index)
Deprecated.
|
protected short |
_getShort(int index)
Deprecated.
|
protected short |
_getShortLE(int index)
Deprecated.
|
protected int |
_getUnsignedMedium(int index)
Deprecated.
|
protected int |
_getUnsignedMediumLE(int index)
Deprecated.
|
protected void |
_setByte(int index,
int value)
Deprecated.
|
protected void |
_setInt(int index,
int value)
Deprecated.
|
protected void |
_setIntLE(int index,
int value)
Deprecated.
|
protected void |
_setLong(int index,
long value)
Deprecated.
|
protected void |
_setLongLE(int index,
long value)
Deprecated.
|
protected void |
_setMedium(int index,
int value)
Deprecated.
|
protected void |
_setMediumLE(int index,
int value)
Deprecated.
|
protected void |
_setShort(int index,
int value)
Deprecated.
|
protected void |
_setShortLE(int index,
int value)
Deprecated.
|
ByteBufAllocator |
alloc()
Deprecated.
Returns the
ByteBufAllocator which created this buffer. |
byte[] |
array()
Deprecated.
Returns the backing byte array of this buffer.
|
int |
arrayOffset()
Deprecated.
Returns the offset of the first byte within the backing byte array of
this buffer.
|
ByteBuf |
asReadOnly()
Deprecated.
Returns a read-only version of this buffer.
|
int |
capacity()
Deprecated.
Returns the number of bytes (octets) this buffer can contain.
|
ByteBuf |
capacity(int newCapacity)
Deprecated.
Adjusts the capacity of this buffer.
|
ByteBuf |
copy(int index,
int length)
Deprecated.
Returns a copy of this buffer's sub-region.
|
ByteBuf |
discardReadBytes()
Deprecated.
Discards the bytes between the 0th index and
readerIndex . |
ByteBuf |
duplicate()
Deprecated.
Returns a buffer which shares the whole region of this buffer.
|
ByteBuf |
ensureWritable(int minWritableBytes)
Deprecated.
Expands the buffer
ByteBuf.capacity() to make sure the number of
writable bytes is equal to or greater than the
specified value. |
int |
ensureWritable(int minWritableBytes,
boolean force)
Deprecated.
Expands the buffer
ByteBuf.capacity() to make sure the number of
writable bytes is equal to or greater than the
specified value. |
int |
forEachByte(int index,
int length,
ByteProcessor processor)
Deprecated.
Iterates over the specified area of this buffer with the specified
processor in ascending order. |
int |
forEachByteDesc(int index,
int length,
ByteProcessor processor)
Deprecated.
Iterates over the specified area of this buffer with the specified
processor in descending order. |
byte |
getByte(int index)
Deprecated.
Gets a byte at the specified absolute
index in this buffer. |
ByteBuf |
getBytes(int index,
byte[] dst,
int dstIndex,
int length)
Deprecated.
Transfers this buffer's data to the specified destination starting at
the specified absolute
index . |
ByteBuf |
getBytes(int index,
ByteBuffer dst)
Deprecated.
Transfers this buffer's data to the specified destination starting at
the specified absolute
index until the destination's position
reaches its limit. |
ByteBuf |
getBytes(int index,
ByteBuf dst,
int dstIndex,
int length)
Deprecated.
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)
Deprecated.
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)
Deprecated.
Transfers this buffer's data to the specified channel starting at the
specified absolute
index . |
ByteBuf |
getBytes(int index,
OutputStream out,
int length)
Deprecated.
Transfers this buffer's data to the specified stream starting at the
specified absolute
index . |
int |
getInt(int index)
Deprecated.
Gets a 32-bit integer at the specified absolute
index in
this buffer. |
int |
getIntLE(int index)
Deprecated.
Gets a 32-bit integer at the specified absolute
index in
this buffer with Little Endian Byte Order. |
long |
getLong(int index)
Deprecated.
Gets a 64-bit long integer at the specified absolute
index in
this buffer. |
long |
getLongLE(int index)
Deprecated.
Gets a 64-bit long integer at the specified absolute
index in
this buffer in Little Endian Byte Order. |
short |
getShort(int index)
Deprecated.
Gets a 16-bit short integer at the specified absolute
index in
this buffer. |
short |
getShortLE(int index)
Deprecated.
Gets a 16-bit short integer at the specified absolute
index in
this buffer in Little Endian Byte Order. |
int |
getUnsignedMedium(int index)
Deprecated.
Gets an unsigned 24-bit medium integer at the specified absolute
index in this buffer. |
int |
getUnsignedMediumLE(int index)
Deprecated.
Gets an unsigned 24-bit medium integer at the specified absolute
index in this buffer in Little Endian Byte Order. |
boolean |
hasArray()
Deprecated.
Returns
true if and only if this buffer has a backing byte array. |
boolean |
hasMemoryAddress()
Deprecated.
Returns
true if and only if this buffer has a reference to the low-level memory address that points
to the backing data. |
boolean |
isDirect()
Deprecated.
Returns
true if and only if this buffer is backed by an
NIO direct buffer. |
boolean |
isReadOnly()
Deprecated.
Returns
true if and only if this buffer is read-only. |
boolean |
isWritable()
Deprecated.
Returns
true
if and only if (this.capacity - this.writerIndex) is greater
than 0 . |
boolean |
isWritable(int numBytes)
Deprecated.
Returns
true if and only if this buffer has enough room to allow writing the specified number of
elements. |
long |
memoryAddress()
Deprecated.
Returns the low-level memory address that point to the first byte of ths backing data.
|
ByteBuffer |
nioBuffer(int index,
int length)
Deprecated.
Exposes this buffer's sub-region as an NIO
ByteBuffer . |
int |
nioBufferCount()
Deprecated.
Returns the maximum number of NIO
ByteBuffer s that consist this buffer. |
ByteBuffer[] |
nioBuffers(int index,
int length)
Deprecated.
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. |
ByteOrder |
order()
Deprecated.
|
ByteBuf |
setByte(int index,
int value)
Deprecated.
Sets the specified byte at the specified absolute
index in this
buffer. |
ByteBuf |
setBytes(int index,
byte[] src,
int srcIndex,
int length)
Deprecated.
Transfers the specified source array's data to this buffer starting at
the specified absolute
index . |
ByteBuf |
setBytes(int index,
ByteBuffer src)
Deprecated.
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. |
ByteBuf |
setBytes(int index,
ByteBuf src,
int srcIndex,
int length)
Deprecated.
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)
Deprecated.
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)
Deprecated.
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)
Deprecated.
Transfers the content of the specified source channel to this buffer
starting at the specified absolute
index . |
ByteBuf |
setInt(int index,
int value)
Deprecated.
Sets the specified 32-bit integer at the specified absolute
index in this buffer. |
ByteBuf |
setIntLE(int index,
int value)
Deprecated.
Sets the specified 32-bit integer at the specified absolute
index in this buffer with Little Endian byte order
. |
ByteBuf |
setLong(int index,
long value)
Deprecated.
Sets the specified 64-bit long integer at the specified absolute
index in this buffer. |
ByteBuf |
setLongLE(int index,
long value)
Deprecated.
Sets the specified 64-bit long integer at the specified absolute
index in this buffer in Little Endian Byte Order. |
ByteBuf |
setMedium(int index,
int value)
Deprecated.
Sets the specified 24-bit medium integer at the specified absolute
index in this buffer. |
ByteBuf |
setMediumLE(int index,
int value)
Deprecated.
Sets the specified 24-bit medium integer at the specified absolute
index in this buffer in the Little Endian Byte Order. |
ByteBuf |
setShort(int index,
int value)
Deprecated.
Sets the specified 16-bit short integer at the specified absolute
index in this buffer. |
ByteBuf |
setShortLE(int index,
int value)
Deprecated.
Sets the specified 16-bit short integer at the specified absolute
index in this buffer with the Little Endian Byte Order. |
ByteBuf |
slice(int index,
int length)
Deprecated.
Returns a slice of this buffer's sub-region.
|
ByteBuf |
unwrap()
Deprecated.
Return the underlying buffer instance if this buffer is a wrapper of another buffer.
|
internalNioBuffer, isContiguous, refCnt, release, release, retain, retain, touch, touch
adjustMarkers, bytesBefore, bytesBefore, bytesBefore, checkDstIndex, checkDstIndex, checkIndex, checkIndex, checkNewCapacity, checkReadableBytes, checkSrcIndex, clear, compareTo, copy, discardSomeReadBytes, ensureAccessible, equals, forEachByte, forEachByteDesc, getBoolean, getBytes, getBytes, getBytes, getChar, getCharSequence, getDouble, getFloat, getMedium, getMediumLE, getUnsignedByte, getUnsignedInt, getUnsignedIntLE, getUnsignedShort, getUnsignedShortLE, hashCode, indexOf, isReadable, isReadable, markReaderIndex, markWriterIndex, maxCapacity, maxCapacity, maxWritableBytes, newSwappedByteBuf, nioBuffer, nioBuffers, order, readableBytes, readBoolean, readByte, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readChar, readCharSequence, readDouble, readerIndex, readerIndex, readFloat, readInt, readIntLE, readLong, readLongLE, readMedium, readMediumLE, readRetainedSlice, readShort, readShortLE, readSlice, readUnsignedByte, readUnsignedInt, readUnsignedIntLE, readUnsignedMedium, readUnsignedMediumLE, readUnsignedShort, readUnsignedShortLE, resetReaderIndex, resetWriterIndex, retainedDuplicate, retainedSlice, retainedSlice, setBoolean, setBytes, setBytes, setBytes, setChar, setCharSequence, setDouble, setFloat, setIndex, setZero, skipBytes, slice, toString, toString, toString, trimIndicesToCapacity, writableBytes, writeBoolean, writeByte, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeChar, writeCharSequence, writeDouble, writeFloat, writeInt, writeIntLE, writeLong, writeLongLE, writeMedium, writeMediumLE, writerIndex, writerIndex, writeShort, writeShortLE, writeZero
asByteBuf, getDoubleLE, getFloatLE, maxFastWritableBytes, readDoubleLE, readFloatLE, setDoubleLE, setFloatLE, writeDoubleLE, writeFloatLE
public ReadOnlyByteBuf(ByteBuf buffer)
public boolean isReadOnly()
ByteBuf
true
if and only if this buffer is read-only.isReadOnly
in class AbstractDerivedByteBuf
public boolean isWritable()
ByteBuf
true
if and only if (this.capacity - this.writerIndex)
is greater
than 0
.isWritable
in class AbstractByteBuf
public boolean isWritable(int numBytes)
ByteBuf
true
if and only if this buffer has enough room to allow writing the specified number of
elements.isWritable
in class AbstractByteBuf
public int ensureWritable(int minWritableBytes, boolean force)
ByteBuf
ByteBuf.capacity()
to make sure the number of
writable bytes is equal to or greater than the
specified value. Unlike ByteBuf.ensureWritable(int)
, this method returns a status code.ensureWritable
in class AbstractByteBuf
minWritableBytes
- the expected minimum number of writable bytesforce
- When ByteBuf.writerIndex()
+ minWritableBytes
> ByteBuf.maxCapacity()
:
true
- the capacity of the buffer is expanded to ByteBuf.maxCapacity()
false
- the capacity of the buffer is unchanged0
if the buffer has enough writable bytes, and its capacity is unchanged.
1
if the buffer does not have enough bytes, and its capacity is unchanged.
2
if the buffer has enough writable bytes, and its capacity has been increased.
3
if the buffer does not have enough bytes, but its capacity has been
increased to its maximum.public ByteBuf ensureWritable(int minWritableBytes)
ByteBuf
ByteBuf.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 AbstractByteBuf
minWritableBytes
- the expected minimum number of writable bytesByteBuf.capacity(int)
public ByteBuf unwrap()
ByteBuf
public ByteBufAllocator alloc()
ByteBuf
ByteBufAllocator
which created this buffer.@Deprecated public ByteOrder order()
ByteBuf
public boolean isDirect()
ByteBuf
true
if and only if this buffer is backed by an
NIO direct buffer.public boolean hasArray()
ByteBuf
true
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()
ByteBuf
public int arrayOffset()
ByteBuf
arrayOffset
in class ByteBuf
public boolean hasMemoryAddress()
ByteBuf
true
if and only if this buffer has a reference to the low-level memory address that points
to the backing data.hasMemoryAddress
in class ByteBuf
public long memoryAddress()
ByteBuf
memoryAddress
in class ByteBuf
public ByteBuf discardReadBytes()
ByteBuf
readerIndex
.
It moves the bytes between readerIndex
and writerIndex
to the 0th index, and sets readerIndex
and writerIndex
to 0
and oldWriterIndex - oldReaderIndex
respectively.
Please refer to the class documentation for more detailed explanation.
discardReadBytes
in class AbstractByteBuf
public ByteBuf setBytes(int index, ByteBuf src, int srcIndex, int length)
ByteBuf
index
.
This method does not modify readerIndex
or writerIndex
of both the source (i.e. this
) and the destination.public ByteBuf setBytes(int index, byte[] src, int srcIndex, int length)
ByteBuf
index
.
This method does not modify readerIndex
or writerIndex
of
this buffer.public ByteBuf setBytes(int index, ByteBuffer src)
ByteBuf
index
until the source buffer's position
reaches its limit.
This method does not modify readerIndex
or writerIndex
of
this buffer.public ByteBuf setByte(int index, int value)
ByteBuf
index
in this
buffer. The 24 high-order bits of the specified value are ignored.
This method does not modify readerIndex
or writerIndex
of
this buffer.setByte
in class AbstractByteBuf
protected void _setByte(int index, int value)
_setByte
in class AbstractByteBuf
public ByteBuf setShort(int index, int value)
ByteBuf
index
in this buffer. The 16 high-order bits of the specified
value are ignored.
This method does not modify readerIndex
or writerIndex
of
this buffer.setShort
in class AbstractByteBuf
protected void _setShort(int index, int value)
_setShort
in class AbstractByteBuf
public ByteBuf setShortLE(int index, int value)
ByteBuf
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 readerIndex
or writerIndex
of
this buffer.setShortLE
in class AbstractByteBuf
protected void _setShortLE(int index, int value)
_setShortLE
in class AbstractByteBuf
public ByteBuf setMedium(int index, int value)
ByteBuf
index
in this buffer. Please note that the most significant
byte is ignored in the specified value.
This method does not modify readerIndex
or writerIndex
of
this buffer.setMedium
in class AbstractByteBuf
protected void _setMedium(int index, int value)
_setMedium
in class AbstractByteBuf
public ByteBuf setMediumLE(int index, int value)
ByteBuf
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 readerIndex
or writerIndex
of
this buffer.setMediumLE
in class AbstractByteBuf
protected void _setMediumLE(int index, int value)
_setMediumLE
in class AbstractByteBuf
public ByteBuf setInt(int index, int value)
ByteBuf
index
in this buffer.
This method does not modify readerIndex
or writerIndex
of
this buffer.setInt
in class AbstractByteBuf
protected void _setInt(int index, int value)
_setInt
in class AbstractByteBuf
public ByteBuf setIntLE(int index, int value)
ByteBuf
index
in this buffer with Little Endian byte order
.
This method does not modify readerIndex
or writerIndex
of
this buffer.setIntLE
in class AbstractByteBuf
protected void _setIntLE(int index, int value)
_setIntLE
in class AbstractByteBuf
public ByteBuf setLong(int index, long value)
ByteBuf
index
in this buffer.
This method does not modify readerIndex
or writerIndex
of
this buffer.setLong
in class AbstractByteBuf
protected void _setLong(int index, long value)
_setLong
in class AbstractByteBuf
public ByteBuf setLongLE(int index, long value)
ByteBuf
index
in this buffer in Little Endian Byte Order.
This method does not modify readerIndex
or writerIndex
of
this buffer.setLongLE
in class AbstractByteBuf
protected void _setLongLE(int index, long value)
_setLongLE
in class AbstractByteBuf
public int setBytes(int index, InputStream in, int length)
ByteBuf
index
.
This method does not modify readerIndex
or writerIndex
of
this buffer.setBytes
in class ByteBuf
length
- the number of bytes to transfer-1
if the specified InputStream
reached EOF.public int setBytes(int index, ScatteringByteChannel in, int length)
ByteBuf
index
.
This method does not modify readerIndex
or writerIndex
of
this buffer.public int setBytes(int index, FileChannel in, long position, int length)
ByteBuf
index
.
This method does not modify readerIndex
or writerIndex
of
this buffer. This method does not modify the channel's position.public int getBytes(int index, GatheringByteChannel out, int length) throws IOException
ByteBuf
index
.
This method does not modify readerIndex
or writerIndex
of
this buffer.getBytes
in class ByteBuf
length
- 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
ByteBuf
index
to the specified channel starting at the given file position.
This method does not modify readerIndex
or writerIndex
of
this buffer. This method does not modify the channel's position.getBytes
in class ByteBuf
position
- 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 ByteBuf getBytes(int index, OutputStream out, int length) throws IOException
ByteBuf
index
.
This method does not modify readerIndex
or writerIndex
of
this buffer.getBytes
in class ByteBuf
length
- the number of bytes to transferIOException
- if the specified stream threw an exception during I/Opublic ByteBuf getBytes(int index, byte[] dst, int dstIndex, int length)
ByteBuf
index
.
This method does not modify readerIndex
or writerIndex
of this buffer.public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length)
ByteBuf
index
.
This method does not modify readerIndex
or writerIndex
of both the source (i.e. this
) and the destination.public ByteBuf getBytes(int index, ByteBuffer dst)
ByteBuf
index
until the destination's position
reaches its limit.
This method does not modify readerIndex
or writerIndex
of
this buffer while the destination's position
will be increased.public ByteBuf duplicate()
ByteBuf
readerIndex
or writerIndex
of
this buffer.
The reader and writer marks will not be duplicated. Also be aware that this method will
NOT call ByteBuf.retain()
and so the reference count will NOT be increased.
duplicate
in class AbstractByteBuf
ByteBuf.slice()
.
However this buffer will share the capacity of the underlying buffer, and therefore allows access to all of the
underlying content if necessary.public ByteBuf copy(int index, int length)
ByteBuf
readerIndex
or writerIndex
of
this buffer.public ByteBuf slice(int index, int length)
ByteBuf
readerIndex
or writerIndex
of
this buffer.
Also be aware that this method will NOT call ByteBuf.retain()
and so the
reference count will NOT be increased.
slice
in class AbstractByteBuf
public byte getByte(int index)
ByteBuf
index
in this buffer.
This method does not modify readerIndex
or writerIndex
of
this buffer.getByte
in class AbstractByteBuf
protected byte _getByte(int index)
_getByte
in class AbstractByteBuf
public short getShort(int index)
ByteBuf
index
in
this buffer. This method does not modify readerIndex
or
writerIndex
of this buffer.getShort
in class AbstractByteBuf
protected short _getShort(int index)
_getShort
in class AbstractByteBuf
public short getShortLE(int index)
ByteBuf
index
in
this buffer in Little Endian Byte Order. This method does not modify
readerIndex
or writerIndex
of this buffer.getShortLE
in class AbstractByteBuf
protected short _getShortLE(int index)
_getShortLE
in class AbstractByteBuf
public int getUnsignedMedium(int index)
ByteBuf
index
in this buffer. This method does not modify
readerIndex
or writerIndex
of this buffer.getUnsignedMedium
in class AbstractByteBuf
protected int _getUnsignedMedium(int index)
_getUnsignedMedium
in class AbstractByteBuf
public int getUnsignedMediumLE(int index)
ByteBuf
index
in this buffer in Little Endian Byte Order.
This method does not modify readerIndex
or
writerIndex
of this buffer.getUnsignedMediumLE
in class AbstractByteBuf
protected int _getUnsignedMediumLE(int index)
_getUnsignedMediumLE
in class AbstractByteBuf
public int getInt(int index)
ByteBuf
index
in
this buffer. This method does not modify readerIndex
or
writerIndex
of this buffer.getInt
in class AbstractByteBuf
protected int _getInt(int index)
_getInt
in class AbstractByteBuf
public int getIntLE(int index)
ByteBuf
index
in
this buffer with Little Endian Byte Order. This method does not
modify readerIndex
or writerIndex
of this buffer.getIntLE
in class AbstractByteBuf
protected int _getIntLE(int index)
_getIntLE
in class AbstractByteBuf
public long getLong(int index)
ByteBuf
index
in
this buffer. This method does not modify readerIndex
or
writerIndex
of this buffer.getLong
in class AbstractByteBuf
protected long _getLong(int index)
_getLong
in class AbstractByteBuf
public long getLongLE(int index)
ByteBuf
index
in
this buffer in Little Endian Byte Order. This method does not
modify readerIndex
or writerIndex
of this buffer.getLongLE
in class AbstractByteBuf
protected long _getLongLE(int index)
_getLongLE
in class AbstractByteBuf
public int nioBufferCount()
ByteBuf
ByteBuffer
s that consist this buffer. Note that ByteBuf.nioBuffers()
or ByteBuf.nioBuffers(int, int)
might return a less number of ByteBuffer
s.nioBufferCount
in class ByteBuf
-1
if this buffer has no underlying ByteBuffer
.
the number of the underlying ByteBuffer
s 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 nioBuffer(int index, int length)
ByteBuf
ByteBuffer
. The returned buffer
either share or contains the copied content of this buffer, while changing the position
and limit of the returned NIO buffer does not affect the indexes and marks of this buffer.
This method does not modify readerIndex
or writerIndex
of this buffer.
Please note that the returned NIO buffer will not see the changes of this buffer if this buffer
is a dynamic buffer and it adjusted its capacity.nioBuffer
in class AbstractDerivedByteBuf
ByteBuf.nioBufferCount()
,
ByteBuf.nioBuffers()
,
ByteBuf.nioBuffers(int, int)
public ByteBuffer[] nioBuffers(int index, int length)
ByteBuf
ByteBuffer
's for the specified index and length
The returned buffer either share or contains the copied content of this buffer, while changing
the position and limit of the returned NIO buffer does not affect the indexes and marks of this buffer.
This method does not modify readerIndex
or writerIndex
of this buffer. Please note that the
returned NIO buffer will not see the changes of this buffer if this buffer is a dynamic
buffer and it adjusted its capacity.nioBuffers
in class ByteBuf
ByteBuf.nioBufferCount()
,
ByteBuf.nioBuffer()
,
ByteBuf.nioBuffer(int, int)
public int forEachByte(int index, int length, ByteProcessor processor)
ByteBuf
processor
in ascending order.
(i.e. index
, (index + 1)
, .. (index + length - 1)
)forEachByte
in class AbstractByteBuf
-1
if the processor iterated to or beyond the end of the specified area.
The last-visited index If the ByteProcessor.process(byte)
returned false
.public int forEachByteDesc(int index, int length, ByteProcessor processor)
ByteBuf
processor
in descending order.
(i.e. (index + length - 1)
, (index + length - 2)
, ... index
)forEachByteDesc
in class AbstractByteBuf
-1
if the processor iterated to or beyond the beginning of the specified area.
The last-visited index If the ByteProcessor.process(byte)
returned false
.public int capacity()
ByteBuf
public ByteBuf capacity(int newCapacity)
ByteBuf
newCapacity
is less than the current
capacity, the content of this buffer is truncated. If the newCapacity
is greater
than the current capacity, the buffer is appended with unspecified data whose length is
(newCapacity - currentCapacity)
.public ByteBuf asReadOnly()
ByteBuf
asReadOnly
in class AbstractByteBuf
Copyright © 2008–2024 The Netty Project. All rights reserved.