Top Description Fields Constructors Methods
io.netty.buffer

public Class ReadOnlyByteBuf

extends AbstractDerivedByteBuf
Class Inheritance
Annotations
@Deprecated
Imports
io.netty.util.ByteProcessor, java.io.IOException, .InputStream, .OutputStream, java.nio.ByteBuffer, .ByteOrder, .ReadOnlyBufferException, java.nio.channels.FileChannel, .GatheringByteChannel, .ScatteringByteChannel

Deprecated

Do not use.

A derived buffer which forbids any write requests to its parent. It is recommended to use Unpooled#unmodifiableBuffer(ByteBuf) instead of calling the constructor explicitly.

Field Summary

Modifier and TypeField and Description
private final ByteBuf

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected byte
_getByte(int index)

Implements abstract io.netty.buffer.AbstractByteBuf._getByte.

protected int
_getInt(int index)

Implements abstract io.netty.buffer.AbstractByteBuf._getInt.

protected int
protected long
_getLong(int index)

Implements abstract io.netty.buffer.AbstractByteBuf._getLong.

protected long
protected short
protected short
protected int
protected int
protected void
_setByte(int index, int value)

Implements abstract io.netty.buffer.AbstractByteBuf._setByte.

protected void
_setInt(int index, int value)

Implements abstract io.netty.buffer.AbstractByteBuf._setInt.

protected void
_setIntLE(int index, int value)

Implements abstract io.netty.buffer.AbstractByteBuf._setIntLE.

protected void
_setLong(int index, long value)

Implements abstract io.netty.buffer.AbstractByteBuf._setLong.

protected void
_setLongLE(int index, long value)

Implements abstract io.netty.buffer.AbstractByteBuf._setLongLE.

protected void
_setMedium(int index, int value)

Implements abstract io.netty.buffer.AbstractByteBuf._setMedium.

protected void
_setMediumLE(int index, int value)

Implements abstract io.netty.buffer.AbstractByteBuf._setMediumLE.

protected void
_setShort(int index, int value)

Implements abstract io.netty.buffer.AbstractByteBuf._setShort.

protected void
_setShortLE(int index, int value)

Implements abstract io.netty.buffer.AbstractByteBuf._setShortLE.

public ByteBufAllocator
alloc()

Implements abstract io.netty.buffer.ByteBuf.alloc.

Returns the ByteBufAllocator which created this buffer.
public byte[]
array()

Implements abstract io.netty.buffer.ByteBuf.array.

Returns the backing byte array of this buffer.
public int
arrayOffset()

Implements abstract io.netty.buffer.ByteBuf.arrayOffset.

Returns the offset of the first byte within the backing byte array of this buffer.
public ByteBuf
asReadOnly()

Overrides io.netty.buffer.AbstractByteBuf.asReadOnly.

Returns a read-only version of this buffer.
public int
capacity()

Implements abstract io.netty.buffer.ByteBuf.capacity.

Returns the number of bytes (octets) this buffer can contain.
public ByteBuf
capacity(int newCapacity)

Implements abstract io.netty.buffer.ByteBuf.capacity.

Adjusts the capacity of this buffer.
public ByteBuf
copy(int index, int length)

Implements abstract io.netty.buffer.ByteBuf.copy.

Returns a copy of this buffer's sub-region.
public ByteBuf
discardReadBytes()

Overrides io.netty.buffer.AbstractByteBuf.discardReadBytes.

Discards the bytes between the 0th index and readerIndex.
public ByteBuf
duplicate()

Overrides io.netty.buffer.AbstractByteBuf.duplicate.

Returns a buffer which shares the whole region of this buffer.
public int
ensureWritable(int
the expected minimum number of writable bytes
minWritableBytes
,
boolean
When writerIndex() + minWritableBytes > maxCapacity():
  • true - the capacity of the buffer is expanded to maxCapacity()
  • false - the capacity of the buffer is unchanged
force
)

Overrides io.netty.buffer.AbstractByteBuf.ensureWritable.

Expands the buffer capacity() to make sure the number of writable bytes is equal to or greater than the specified value.
public ByteBuf
ensureWritable(int
the expected minimum number of writable bytes
minWritableBytes
)

Overrides io.netty.buffer.AbstractByteBuf.ensureWritable.

Expands the buffer capacity() to make sure the number of writable bytes is equal to or greater than the specified value.
public int
forEachByte(int index, int length, ByteProcessor processor)

Overrides io.netty.buffer.AbstractByteBuf.forEachByte.

Iterates over the specified area of this buffer with the specified processor in ascending order.
public int
forEachByteDesc(int index, int length, ByteProcessor processor)

Overrides io.netty.buffer.AbstractByteBuf.forEachByteDesc.

Iterates over the specified area of this buffer with the specified processor in descending order.
public byte
getByte(int index)

Overrides io.netty.buffer.AbstractByteBuf.getByte.

Gets a byte at the specified absolute index in this buffer.
public int
getBytes(int index, GatheringByteChannel out, int
the maximum number of bytes to transfer
length
)

Implements abstract io.netty.buffer.ByteBuf.getBytes.

Transfers this buffer's data to the specified channel starting at the specified absolute index.
public int
getBytes(int index, FileChannel out, long
the file position at which the transfer is to begin
position
,
int
the maximum number of bytes to transfer
length
)

Implements abstract io.netty.buffer.ByteBuf.getBytes.

Transfers this buffer's data starting at the specified absolute index to the specified channel starting at the given file position.
public ByteBuf
getBytes(int index, OutputStream out, int
the number of bytes to transfer
length
)

Implements abstract io.netty.buffer.ByteBuf.getBytes.

Transfers this buffer's data to the specified stream starting at the specified absolute index.
public ByteBuf
getBytes(int index, byte[] dst, int
the first index of the destination
dstIndex
,
int
the number of bytes to transfer
length
)

Implements abstract io.netty.buffer.ByteBuf.getBytes.

Transfers this buffer's data to the specified destination starting at the specified absolute index.
public ByteBuf
getBytes(int index, ByteBuf dst, int
the first index of the destination
dstIndex
,
int
the number of bytes to transfer
length
)

Implements abstract io.netty.buffer.ByteBuf.getBytes.

Transfers this buffer's data to the specified destination starting at the specified absolute index.
public ByteBuf
getBytes(int index, ByteBuffer dst)

Implements abstract io.netty.buffer.ByteBuf.getBytes.

Transfers this buffer's data to the specified destination starting at the specified absolute index until the destination's position reaches its limit.
public int
getInt(int index)

Overrides io.netty.buffer.AbstractByteBuf.getInt.

Gets a 32-bit integer at the specified absolute index in this buffer.
public int
getIntLE(int index)

Overrides io.netty.buffer.AbstractByteBuf.getIntLE.

Gets a 32-bit integer at the specified absolute index in this buffer with Little Endian Byte Order.
public long
getLong(int index)

Overrides io.netty.buffer.AbstractByteBuf.getLong.

Gets a 64-bit long integer at the specified absolute index in this buffer.
public long
getLongLE(int index)

Overrides io.netty.buffer.AbstractByteBuf.getLongLE.

Gets a 64-bit long integer at the specified absolute index in this buffer in Little Endian Byte Order.
public short
getShort(int index)

Overrides io.netty.buffer.AbstractByteBuf.getShort.

Gets a 16-bit short integer at the specified absolute index in this buffer.
public short
getShortLE(int index)

Overrides io.netty.buffer.AbstractByteBuf.getShortLE.

Gets a 16-bit short integer at the specified absolute index in this buffer in Little Endian Byte Order.
public int
getUnsignedMedium(int index)

Overrides io.netty.buffer.AbstractByteBuf.getUnsignedMedium.

Gets an unsigned 24-bit medium integer at the specified absolute index in this buffer.
public int
getUnsignedMediumLE(int index)

Overrides io.netty.buffer.AbstractByteBuf.getUnsignedMediumLE.

Gets an unsigned 24-bit medium integer at the specified absolute index in this buffer in Little Endian Byte Order.
public boolean
hasArray()

Implements abstract io.netty.buffer.ByteBuf.hasArray.

Returns true if and only if this buffer has a backing byte array.
public boolean
hasMemoryAddress()

Implements abstract io.netty.buffer.ByteBuf.hasMemoryAddress.

Returns true if and only if this buffer has a reference to the low-level memory address that points to the backing data.
public boolean
isDirect()

Implements abstract io.netty.buffer.ByteBuf.isDirect.

Returns true if and only if this buffer is backed by an NIO direct buffer.
public boolean
isReadOnly()

Overrides io.netty.buffer.AbstractDerivedByteBuf.isReadOnly.

Returns true if and only if this buffer is read-only.
public boolean
isWritable()

Overrides io.netty.buffer.AbstractByteBuf.isWritable.

Returns true if and only if (this.capacity - this.writerIndex) is greater than 0.
public boolean
isWritable(int numBytes)

Overrides io.netty.buffer.AbstractByteBuf.isWritable.

Returns true if and only if this buffer has enough room to allow writing the specified number of elements.
public long
memoryAddress()

Implements abstract io.netty.buffer.ByteBuf.memoryAddress.

Returns the low-level memory address that point to the first byte of ths backing data.
public ByteBuffer
nioBuffer(int index, int length)

Overrides io.netty.buffer.AbstractDerivedByteBuf.nioBuffer.

Exposes this buffer's sub-region as an NIO ByteBuffer.
public int
nioBufferCount()

Implements abstract io.netty.buffer.ByteBuf.nioBufferCount.

Returns the maximum number of NIO ByteBuffers that consist this buffer.
public ByteBuffer[]
nioBuffers(int index, int length)

Implements abstract io.netty.buffer.ByteBuf.nioBuffers.

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.
public ByteOrder
order()

Implements abstract io.netty.buffer.ByteBuf.order.

Deprecated
Returns the endianness of this buffer.
public ByteBuf
setByte(int index, int value)

Overrides io.netty.buffer.AbstractByteBuf.setByte.

Sets the specified byte at the specified absolute index in this buffer.
public ByteBuf
setBytes(int index, ByteBuf src, int
the first index of the source
srcIndex
,
int
the number of bytes to transfer
length
)

Implements abstract io.netty.buffer.ByteBuf.setBytes.

Transfers the specified source buffer's data to this buffer starting at the specified absolute index.
public ByteBuf
setBytes(int index, byte[] src, int srcIndex, int length)

Implements abstract io.netty.buffer.ByteBuf.setBytes.

Transfers the specified source array's data to this buffer starting at the specified absolute index.
public ByteBuf
setBytes(int index, ByteBuffer src)

Implements abstract io.netty.buffer.ByteBuf.setBytes.

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.
public int
setBytes(int index, InputStream in, int
the number of bytes to transfer
length
)

Implements abstract io.netty.buffer.ByteBuf.setBytes.

Transfers the content of the specified source stream to this buffer starting at the specified absolute index.
public int
setBytes(int index, ScatteringByteChannel in, int
the maximum number of bytes to transfer
length
)

Implements abstract io.netty.buffer.ByteBuf.setBytes.

Transfers the content of the specified source channel to this buffer starting at the specified absolute index.
public int
setBytes(int index, FileChannel in, long
the file position at which the transfer is to begin
position
,
int
the maximum number of bytes to transfer
length
)

Implements abstract io.netty.buffer.ByteBuf.setBytes.

Transfers the content of the specified source channel starting at the given file position to this buffer starting at the specified absolute index.
public ByteBuf
setInt(int index, int value)

Overrides io.netty.buffer.AbstractByteBuf.setInt.

Sets the specified 32-bit integer at the specified absolute index in this buffer.
public ByteBuf
setIntLE(int index, int value)

Overrides io.netty.buffer.AbstractByteBuf.setIntLE.

Sets the specified 32-bit integer at the specified absolute index in this buffer with Little Endian byte order .
public ByteBuf
setLong(int index, long value)

Overrides io.netty.buffer.AbstractByteBuf.setLong.

Sets the specified 64-bit long integer at the specified absolute index in this buffer.
public ByteBuf
setLongLE(int index, long value)

Overrides io.netty.buffer.AbstractByteBuf.setLongLE.

Sets the specified 64-bit long integer at the specified absolute index in this buffer in Little Endian Byte Order.
public ByteBuf
setMedium(int index, int value)

Overrides io.netty.buffer.AbstractByteBuf.setMedium.

Sets the specified 24-bit medium integer at the specified absolute index in this buffer.
public ByteBuf
setMediumLE(int index, int value)

Overrides io.netty.buffer.AbstractByteBuf.setMediumLE.

Sets the specified 24-bit medium integer at the specified absolute index in this buffer in the Little Endian Byte Order.
public ByteBuf
setShort(int index, int value)

Overrides io.netty.buffer.AbstractByteBuf.setShort.

Sets the specified 16-bit short integer at the specified absolute index in this buffer.
public ByteBuf
setShortLE(int index, int value)

Overrides io.netty.buffer.AbstractByteBuf.setShortLE.

Sets the specified 16-bit short integer at the specified absolute index in this buffer with the Little Endian Byte Order.
public ByteBuf
slice(int index, int length)

Overrides io.netty.buffer.AbstractByteBuf.slice.

Returns a slice of this buffer's sub-region.
public ByteBuf
unwrap()

Implements abstract io.netty.buffer.ByteBuf.unwrap.

Return the underlying buffer instance if this buffer is a wrapper of another buffer.
Inherited from io.netty.buffer.AbstractDerivedByteBuf:
internalNioBufferisAccessibleisAccessible0isContiguousrefCntrefCnt0releasereleaserelease0release0retainretainretain0retain0touchtouchtouch0touch0