abstract class PooledByteBuf<T> extends AbstractReferenceCountedByteBuf
| Modifier and Type | Field and Description |
|---|---|
(package private) PoolThreadCache |
cache |
protected PoolChunk<T> |
chunk |
protected long |
handle |
protected int |
length |
(package private) int |
maxLength |
protected T |
memory |
protected int |
offset |
private Recycler.Handle |
recyclerHandle |
private java.nio.ByteBuffer |
tmpNioBuf |
leakDetector, readerIndex, writerIndex| Modifier | Constructor and Description |
|---|---|
protected |
PooledByteBuf(Recycler.Handle recyclerHandle,
int maxCapacity) |
| Modifier and Type | Method and Description |
|---|---|
ByteBufAllocator |
alloc()
Returns the
ByteBufAllocator which created this buffer. |
int |
capacity()
Returns the number of bytes (octets) this buffer can contain.
|
ByteBuf |
capacity(int newCapacity)
Adjusts the capacity of this buffer.
|
protected void |
deallocate()
Called once
AbstractReferenceCountedByteBuf.refCnt() is equals 0. |
protected int |
idx(int index) |
(package private) void |
init(PoolChunk<T> chunk,
long handle,
int offset,
int length,
int maxLength,
PoolThreadCache cache) |
(package private) void |
initUnpooled(PoolChunk<T> chunk,
int length) |
protected java.nio.ByteBuffer |
internalNioBuffer() |
protected abstract java.nio.ByteBuffer |
newInternalNioBuffer(T memory) |
java.nio.ByteOrder |
order()
Returns the endianness
of this buffer.
|
private void |
recycle() |
protected abstract Recycler<?> |
recycler() |
(package private) void |
reuse(int maxCapacity)
Method must be called before reuse this
PooledByteBufAllocator |
ByteBuf |
unwrap()
Return the underlying buffer instance if this buffer is a wrapper of another buffer.
|
refCnt, release, release, retain, retain, setRefCnt_getByte, _getInt, _getLong, _getShort, _getUnsignedMedium, _setByte, _setInt, _setLong, _setMedium, _setShort, adjustMarkers, bytesBefore, bytesBefore, bytesBefore, checkDstIndex, checkIndex, checkIndex, checkIndex0, checkReadableBytes, checkSrcIndex, clear, compareTo, copy, discardMarks, discardReadBytes, discardSomeReadBytes, duplicate, ensureAccessible, ensureWritable, ensureWritable, equals, forEachByte, forEachByte, forEachByteDesc, forEachByteDesc, getBoolean, getByte, getBytes, getBytes, getBytes, getChar, getDouble, getFloat, getInt, getLong, getMedium, getShort, getUnsignedByte, getUnsignedInt, getUnsignedMedium, getUnsignedShort, hashCode, indexOf, isReadable, isReadable, isWritable, isWritable, markReaderIndex, markWriterIndex, maxCapacity, maxCapacity, maxWritableBytes, newSwappedByteBuf, nioBuffer, nioBuffers, order, readableBytes, readBoolean, readByte, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readChar, readDouble, readerIndex, readerIndex, readFloat, readInt, readLong, readMedium, readShort, readSlice, readUnsignedByte, readUnsignedInt, readUnsignedMedium, readUnsignedShort, resetReaderIndex, resetWriterIndex, setBoolean, setByte, setBytes, setBytes, setBytes, setChar, setDouble, setFloat, setIndex, setIndex0, setInt, setLong, setMedium, setShort, setZero, skipBytes, slice, slice, toString, toString, toString, writableBytes, writeBoolean, writeByte, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeChar, writeDouble, writeFloat, writeInt, writeLong, writeMedium, writerIndex, writerIndex, writeShort, writeZeroarray, arrayOffset, copy, getBytes, getBytes, getBytes, getBytes, getBytes, hasArray, hasMemoryAddress, internalNioBuffer, isDirect, memoryAddress, nioBuffer, nioBufferCount, nioBuffers, setBytes, setBytes, setBytes, setBytes, setBytesprivate final Recycler.Handle recyclerHandle
protected long handle
protected T memory
protected int offset
protected int length
int maxLength
PoolThreadCache cache
private java.nio.ByteBuffer tmpNioBuf
protected PooledByteBuf(Recycler.Handle recyclerHandle, int maxCapacity)
void init(PoolChunk<T> chunk, long handle, int offset, int length, int maxLength, PoolThreadCache cache)
final void reuse(int maxCapacity)
PooledByteBufAllocatorpublic final int capacity()
ByteBufpublic final ByteBuf 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 final ByteBufAllocator alloc()
ByteBufByteBufAllocator which created this buffer.public final java.nio.ByteOrder order()
ByteBufpublic final ByteBuf unwrap()
ByteBufprotected final java.nio.ByteBuffer internalNioBuffer()
protected abstract java.nio.ByteBuffer newInternalNioBuffer(T memory)
protected final void deallocate()
AbstractReferenceCountedByteBufAbstractReferenceCountedByteBuf.refCnt() is equals 0.deallocate in class AbstractReferenceCountedByteBufprivate void recycle()
protected abstract Recycler<?> recycler()
protected final int idx(int index)