Top Description Inners Fields Constructors Methods
io.netty.buffer

pack-priv abstract Class AbstractPooledDerivedByteBuf

extends AbstractReferenceCountedByteBuf
Class Inheritance
Known Direct Subclasses
io.netty.buffer.PooledDuplicatedByteBuf, io.netty.buffer.PooledSlicedByteBuf
Imports
io.netty.util.Recycler.EnhancedHandle, io.netty.util.internal.ObjectPool.Handle, java.nio.ByteBuffer, .ByteOrder

Abstract base class for derived ByteBuf implementations.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private ByteBuf
parent

Deallocations of a pooled derived buffer should always propagate through the entire chain of derived buffers.

private final Recycler.EnhancedHandle<AbstractPooledDerivedByteBuf>
private AbstractByteBuf

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public final 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.
protected final void
pack-priv final ByteBuf
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.
pack-priv final <U extends AbstractPooledDerivedByteBuf> U
init(AbstractByteBuf unwrapped, ByteBuf wrapped, int readerIndex, int writerIndex, int maxCapacity)

public final ByteBuffer
internalNioBuffer(int index, int length)

Implements abstract io.netty.buffer.ByteBuf.internalNioBuffer.

Internal use only: Exposes the internal NIO buffer.
public boolean
isContiguous()

Overrides io.netty.buffer.ByteBuf.isContiguous.

Returns true if this ByteBuf implementation is backed by a single memory region.
public final 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.AbstractByteBuf.isReadOnly.

Returns true if and only if this buffer is read-only.
public final int
nioBufferCount()

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

Returns the maximum number of NIO ByteBuffers that consist this buffer.
public final ByteOrder
order()

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

Deprecated
Returns the endianness of this buffer.
pack-priv final void
parent(ByteBuf newParent)

public final ByteBuf
retainedSlice()

Overrides io.netty.buffer.AbstractByteBuf.retainedSlice.

Returns a retained slice of this buffer's readable bytes.
public ByteBuf
slice(int index, int length)

Overrides io.netty.buffer.AbstractByteBuf.slice.

Returns a slice of this buffer's sub-region.
public final AbstractByteBuf
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.AbstractReferenceCountedByteBuf:
isAccessiblerefCntreleasereleaseresetRefCntretainretainsetRefCnttouchtouch

Field Detail

parentback to summary
private ByteBuf parent

Deallocations of a pooled derived buffer should always propagate through the entire chain of derived buffers. This is because each pooled derived buffer maintains its own reference count and we should respect each one. If deallocations cause a release of the "root parent" then then we may prematurely release the underlying content before all the derived buffers have been released.

recyclerHandleback to summary
private final Recycler.EnhancedHandle<AbstractPooledDerivedByteBuf> recyclerHandle
rootParentback to summary
private AbstractByteBuf rootParent

Constructor Detail

AbstractPooledDerivedByteBufback to summary
pack-priv AbstractPooledDerivedByteBuf(ObjectPool.Handle<? extends AbstractPooledDerivedByteBuf> recyclerHandle)
Annotations
@SuppressWarnings:unchecked

Method Detail

allocback to summary
public final ByteBufAllocator alloc()

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

Doc from io.netty.buffer.ByteBuf.alloc.

Returns the ByteBufAllocator which created this buffer.

Annotations
@Override
arrayback to summary
public byte[] array()

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

Doc from io.netty.buffer.ByteBuf.array.

Returns the backing byte array of this buffer.

Annotations
@Override
deallocateback to summary
protected final void deallocate()

Implements abstract io.netty.buffer.AbstractReferenceCountedByteBuf.deallocate.

Doc from io.netty.buffer.AbstractReferenceCountedByteBuf.deallocate.

Called once refCnt() is equals 0.

Annotations
@Override
duplicate0back to summary
pack-priv final ByteBuf duplicate0()
hasArrayback to summary
public boolean hasArray()

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

Doc from io.netty.buffer.ByteBuf.hasArray.

Returns true if and only if this buffer has a backing byte array. If this method returns true, you can safely call array() and arrayOffset().

Annotations
@Override
hasMemoryAddressback to summary
public boolean hasMemoryAddress()

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

Doc from 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.

Annotations
@Override
initback to summary
pack-priv final <U extends AbstractPooledDerivedByteBuf> U init(AbstractByteBuf unwrapped, ByteBuf wrapped, int readerIndex, int writerIndex, int maxCapacity)
internalNioBufferback to summary
public final ByteBuffer internalNioBuffer(int index, int length)

Implements abstract io.netty.buffer.ByteBuf.internalNioBuffer.

Doc from io.netty.buffer.ByteBuf.internalNioBuffer.

Internal use only: Exposes the internal NIO buffer.

Annotations
@Override
isContiguousback to summary
public boolean isContiguous()

Overrides io.netty.buffer.ByteBuf.isContiguous.

Doc from io.netty.buffer.ByteBuf.isContiguous.

Returns true if this ByteBuf implementation is backed by a single memory region. Composite buffer implementations must return false even if they currently hold ≤ 1 components. For buffers that return true, it's guaranteed that a successful call to discardReadBytes() will increase the value of maxFastWritableBytes() by the current readerIndex.

This method will return false by default, and a false return value does not necessarily mean that the implementation is composite or that it is not backed by a single memory region.

Annotations
@Override
isDirectback to summary
public final boolean isDirect()

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

Doc from io.netty.buffer.ByteBuf.isDirect.

Returns true if and only if this buffer is backed by an NIO direct buffer.

Annotations
@Override
isReadOnlyback to summary
public boolean isReadOnly()

Overrides io.netty.buffer.AbstractByteBuf.isReadOnly.

Doc from io.netty.buffer.ByteBuf.isReadOnly.

Returns true if and only if this buffer is read-only.

Annotations
@Override
nioBufferCountback to summary
public final int nioBufferCount()

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

Doc from io.netty.buffer.ByteBuf.nioBufferCount.

Returns the maximum number of NIO ByteBuffers that consist this buffer. Note that nioBuffers() or nioBuffers(int, int) might return a less number of ByteBuffers.

Returns:int

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

Annotations
@Override
orderback to summary
public final ByteOrder order()

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

Doc from io.netty.buffer.ByteBuf.order.

Deprecated

Returns the endianness of this buffer.

Annotations
@Override
@Deprecated
parentback to summary
pack-priv final void parent(ByteBuf newParent)
retainedSliceback to summary
public final ByteBuf retainedSlice()

Overrides io.netty.buffer.AbstractByteBuf.retainedSlice.

Doc from io.netty.buffer.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 buf.slice(buf.readerIndex(), buf.readableBytes()). This method does not modify readerIndex or writerIndex of this buffer.

Note that this method returns a retained buffer unlike slice(). This method behaves similarly to slice().retain() except that this method may return a buffer implementation that produces less garbage.

Annotations
@Override
sliceback to summary
public ByteBuf slice(int index, int length)

Overrides io.netty.buffer.AbstractByteBuf.slice.

Doc from io.netty.buffer.ByteBuf.slice.

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 readerIndex or writerIndex of this buffer.

Also be aware that this method will NOT call retain() and so the reference count will NOT be increased.

Annotations
@Override
unwrapback to summary
public final AbstractByteBuf unwrap()

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

Doc from io.netty.buffer.ByteBuf.unwrap.

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

Returns:AbstractByteBuf

null if this buffer is not a wrapper

Annotations
@Override
io.netty.buffer back to summary

private final Class AbstractPooledDerivedByteBuf.PooledNonRetainedDuplicateByteBuf

extends UnpooledDuplicatedByteBuf
Class Inheritance

Deprecated

as a consequence of UnpooledDuplicatedByteBuf being deprecated. See corresponding docs for further information.

Field Summary

Modifier and TypeField and Description
private final ByteBuf

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public ByteBuf
duplicate()

Overrides io.netty.buffer.AbstractByteBuf.duplicate.

Returns a buffer which shares the whole region of this buffer.
pack-priv boolean
pack-priv int
pack-priv boolean
pack-priv boolean
pack-priv ByteBuf
pack-priv ByteBuf
public ByteBuf
retainedDuplicate()

Overrides io.netty.buffer.AbstractByteBuf.retainedDuplicate.

Returns a retained buffer which shares the whole region of this buffer.
public ByteBuf
retainedSlice()

Overrides io.netty.buffer.AbstractByteBuf.retainedSlice.

Returns a retained slice of this buffer's readable bytes.
public ByteBuf
retainedSlice(int index, int length)

Overrides io.netty.buffer.AbstractByteBuf.retainedSlice.

Returns a retained slice of this buffer's sub-region.
public ByteBuf
slice(int index, int length)

Overrides io.netty.buffer.DuplicatedByteBuf.slice.

Returns a slice of this buffer's sub-region.
pack-priv ByteBuf
pack-priv ByteBuf
Inherited from io.netty.buffer.UnpooledDuplicatedByteBuf:
_getByte_getInt_getIntLE_getLong_getLongLE_getShort_getShortLE_getUnsignedMedium_getUnsignedMediumLE_setByte_setInt_setIntLE_setLong_setLongLE_setMedium_setMediumLE_setShort_setShortLEunwrap

Field Detail

referenceCountDelegateback to summary
private final ByteBuf referenceCountDelegate

Constructor Detail

PooledNonRetainedDuplicateByteBufback to summary
pack-priv PooledNonRetainedDuplicateByteBuf(ByteBuf referenceCountDelegate, AbstractByteBuf buffer)

Method Detail

duplicateback to summary
public ByteBuf duplicate()

Overrides io.netty.buffer.AbstractByteBuf.duplicate.

Doc from io.netty.buffer.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 readerIndex or writerIndex of this buffer.

The reader and writer marks will not be duplicated. Also be aware that this method will NOT call retain() and so the reference count will NOT be increased.

Returns:ByteBuf

A buffer whose readable content is equivalent to the buffer returned by slice(). However this buffer will share the capacity of the underlying buffer, and therefore allows access to all of the underlying content if necessary.

Annotations
@Override
isAccessible0back to summary
pack-priv boolean isAccessible0()

Overrides io.netty.buffer.AbstractDerivedByteBuf.isAccessible0.

Annotations
@Override
refCnt0back to summary
pack-priv int refCnt0()

Overrides io.netty.buffer.AbstractDerivedByteBuf.refCnt0.

Annotations
@Override
release0back to summary
pack-priv boolean release0()

Overrides io.netty.buffer.AbstractDerivedByteBuf.release0.

Annotations
@Override
release0back to summary
pack-priv boolean release0(int decrement)

Overrides io.netty.buffer.AbstractDerivedByteBuf.release0.

Annotations
@Override
retain0back to summary
pack-priv ByteBuf retain0()

Overrides io.netty.buffer.AbstractDerivedByteBuf.retain0.

Annotations
@Override
retain0back to summary
pack-priv ByteBuf retain0(int increment)

Overrides io.netty.buffer.AbstractDerivedByteBuf.retain0.

Annotations
@Override
retainedDuplicateback to summary
public ByteBuf retainedDuplicate()

Overrides io.netty.buffer.AbstractByteBuf.retainedDuplicate.

Doc from io.netty.buffer.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 buf.slice(0, buf.capacity()). This method does not modify readerIndex or writerIndex of this buffer.

Note that this method returns a retained buffer unlike slice(int, int). This method behaves similarly to duplicate().retain() except that this method may return a buffer implementation that produces less garbage.

Annotations
@Override
retainedSliceback to summary
public ByteBuf retainedSlice()

Overrides io.netty.buffer.AbstractByteBuf.retainedSlice.

Doc from io.netty.buffer.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 buf.slice(buf.readerIndex(), buf.readableBytes()). This method does not modify readerIndex or writerIndex of this buffer.

Note that this method returns a retained buffer unlike slice(). This method behaves similarly to slice().retain() except that this method may return a buffer implementation that produces less garbage.

Annotations
@Override
retainedSliceback to summary
public ByteBuf retainedSlice(int index, int length)

Overrides io.netty.buffer.AbstractByteBuf.retainedSlice.

Doc from io.netty.buffer.ByteBuf.retainedSlice.

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 readerIndex or writerIndex of this buffer.

Note that this method returns a retained buffer unlike slice(int, int). This method behaves similarly to slice(...).retain() except that this method may return a buffer implementation that produces less garbage.

Annotations
@Override
sliceback to summary
public ByteBuf slice(int index, int length)

Overrides io.netty.buffer.DuplicatedByteBuf.slice.

Doc from io.netty.buffer.ByteBuf.slice.

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 readerIndex or writerIndex of this buffer.

Also be aware that this method will NOT call retain() and so the reference count will NOT be increased.

Annotations
@Override
touch0back to summary
pack-priv ByteBuf touch0()

Overrides io.netty.buffer.AbstractDerivedByteBuf.touch0.

Annotations
@Override
touch0back to summary
pack-priv ByteBuf touch0(Object hint)

Overrides io.netty.buffer.AbstractDerivedByteBuf.touch0.

Annotations
@Override
io.netty.buffer back to summary

private final Class AbstractPooledDerivedByteBuf.PooledNonRetainedSlicedByteBuf

extends UnpooledSlicedByteBuf
Class Inheritance

Deprecated

as a consequence of UnpooledSlicedByteBuf being deprecated. See corresponding docs for further information.

Field Summary

Modifier and TypeField and Description
private final ByteBuf

Constructor Summary

AccessConstructor and Description
pack-priv
PooledNonRetainedSlicedByteBuf(ByteBuf referenceCountDelegate, AbstractByteBuf buffer, int index, int length)

Method Summary

Modifier and TypeMethod and Description
public ByteBuf
duplicate()

Overrides io.netty.buffer.AbstractUnpooledSlicedByteBuf.duplicate.

Returns a buffer which shares the whole region of this buffer.
pack-priv boolean
pack-priv int
pack-priv boolean
pack-priv boolean
pack-priv ByteBuf
pack-priv ByteBuf
public ByteBuf
retainedDuplicate()

Overrides io.netty.buffer.AbstractByteBuf.retainedDuplicate.

Returns a retained buffer which shares the whole region of this buffer.
public ByteBuf
retainedSlice()

Overrides io.netty.buffer.AbstractByteBuf.retainedSlice.

Returns a retained slice of this buffer's readable bytes.
public ByteBuf
retainedSlice(int index, int length)

Overrides io.netty.buffer.AbstractByteBuf.retainedSlice.

Returns a retained slice of this buffer's sub-region.
public ByteBuf
slice(int index, int length)

Overrides io.netty.buffer.AbstractUnpooledSlicedByteBuf.slice.

Returns a slice of this buffer's sub-region.
pack-priv ByteBuf
pack-priv ByteBuf
Inherited from io.netty.buffer.UnpooledSlicedByteBuf:
_getByte_getInt_getIntLE_getLong_getLongLE_getShort_getShortLE_getUnsignedMedium_getUnsignedMediumLE_setByte_setInt_setIntLE_setLong_setLongLE_setMedium_setMediumLE_setShort_setShortLEcapacityunwrap

Field Detail

referenceCountDelegateback to summary
private final ByteBuf referenceCountDelegate

Constructor Detail

PooledNonRetainedSlicedByteBufback to summary
pack-priv PooledNonRetainedSlicedByteBuf(ByteBuf referenceCountDelegate, AbstractByteBuf buffer, int index, int length)

Method Detail

duplicateback to summary
public ByteBuf duplicate()

Overrides io.netty.buffer.AbstractUnpooledSlicedByteBuf.duplicate.

Doc from io.netty.buffer.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 readerIndex or writerIndex of this buffer.

The reader and writer marks will not be duplicated. Also be aware that this method will NOT call retain() and so the reference count will NOT be increased.

Returns:ByteBuf

A buffer whose readable content is equivalent to the buffer returned by slice(). However this buffer will share the capacity of the underlying buffer, and therefore allows access to all of the underlying content if necessary.

Annotations
@Override
isAccessible0back to summary
pack-priv boolean isAccessible0()

Overrides io.netty.buffer.AbstractDerivedByteBuf.isAccessible0.

Annotations
@Override
refCnt0back to summary
pack-priv int refCnt0()

Overrides io.netty.buffer.AbstractDerivedByteBuf.refCnt0.

Annotations
@Override
release0back to summary
pack-priv boolean release0()

Overrides io.netty.buffer.AbstractDerivedByteBuf.release0.

Annotations
@Override
release0back to summary
pack-priv boolean release0(int decrement)

Overrides io.netty.buffer.AbstractDerivedByteBuf.release0.

Annotations
@Override
retain0back to summary
pack-priv ByteBuf retain0()

Overrides io.netty.buffer.AbstractDerivedByteBuf.retain0.

Annotations
@Override
retain0back to summary
pack-priv ByteBuf retain0(int increment)

Overrides io.netty.buffer.AbstractDerivedByteBuf.retain0.

Annotations
@Override
retainedDuplicateback to summary
public ByteBuf retainedDuplicate()

Overrides io.netty.buffer.AbstractByteBuf.retainedDuplicate.

Doc from io.netty.buffer.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 buf.slice(0, buf.capacity()). This method does not modify readerIndex or writerIndex of this buffer.

Note that this method returns a retained buffer unlike slice(int, int). This method behaves similarly to duplicate().retain() except that this method may return a buffer implementation that produces less garbage.

Annotations
@Override
retainedSliceback to summary
public ByteBuf retainedSlice()

Overrides io.netty.buffer.AbstractByteBuf.retainedSlice.

Doc from io.netty.buffer.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 buf.slice(buf.readerIndex(), buf.readableBytes()). This method does not modify readerIndex or writerIndex of this buffer.

Note that this method returns a retained buffer unlike slice(). This method behaves similarly to slice().retain() except that this method may return a buffer implementation that produces less garbage.

Annotations
@Override
retainedSliceback to summary
public ByteBuf retainedSlice(int index, int length)

Overrides io.netty.buffer.AbstractByteBuf.retainedSlice.

Doc from io.netty.buffer.ByteBuf.retainedSlice.

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 readerIndex or writerIndex of this buffer.

Note that this method returns a retained buffer unlike slice(int, int). This method behaves similarly to slice(...).retain() except that this method may return a buffer implementation that produces less garbage.

Annotations
@Override
sliceback to summary
public ByteBuf slice(int index, int length)

Overrides io.netty.buffer.AbstractUnpooledSlicedByteBuf.slice.

Doc from io.netty.buffer.ByteBuf.slice.

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 readerIndex or writerIndex of this buffer.

Also be aware that this method will NOT call retain() and so the reference count will NOT be increased.

Annotations
@Override
touch0back to summary
pack-priv ByteBuf touch0()

Overrides io.netty.buffer.AbstractDerivedByteBuf.touch0.

Annotations
@Override
touch0back to summary
pack-priv ByteBuf touch0(Object hint)

Overrides io.netty.buffer.AbstractDerivedByteBuf.touch0.

Annotations
@Override