Top Description Inners Fields Constructors Methods
io.netty.buffer

public final Class UnpooledByteBufAllocator

extends AbstractByteBufAllocator
implements ByteBufAllocatorMetricProvider
Class Inheritance
All Implemented Interfaces
io.netty.buffer.ByteBufAllocatorMetricProvider
Imports
io.netty.util.internal.LongCounter, .PlatformDependent, .StringUtil, java.nio.ByteBuffer

Simplistic ByteBufAllocator implementation that does not pool anything.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
public static final UnpooledByteBufAllocator
DEFAULT

Hides io.netty.buffer.ByteBufAllocator.DEFAULT.

Default instance which uses leak-detection for direct buffers.
private final boolean
private final UnpooledByteBufAllocator.UnpooledByteBufAllocatorMetric
private final boolean
Inherited from io.netty.buffer.AbstractByteBufAllocator:
CALCULATE_THRESHOLDDEFAULT_INITIAL_CAPACITYDEFAULT_MAX_CAPACITYDEFAULT_MAX_COMPONENTS

Constructor Summary

AccessConstructor and Description
public
UnpooledByteBufAllocator(boolean
true if buffer(int) should try to allocate a direct buffer rather than a heap buffer
preferDirect
)

Create a new instance which uses leak-detection for direct buffers.

public
UnpooledByteBufAllocator(boolean
true if buffer(int) should try to allocate a direct buffer rather than a heap buffer
preferDirect
,
boolean
true if the leak-detection should be disabled completely for this allocator. This can be useful if the user just want to depend on the GC to handle direct buffers when not explicit released.
disableLeakDetector
)

Create a new instance

public
UnpooledByteBufAllocator(boolean
true if buffer(int) should try to allocate a direct buffer rather than a heap buffer
preferDirect
,
boolean
true if the leak-detection should be disabled completely for this allocator. This can be useful if the user just want to depend on the GC to handle direct buffers when not explicit released.
disableLeakDetector
,
boolean
true if we should try to use PlatformDependent#allocateDirectNoCleaner(int) to allocate direct memory.
tryNoCleaner
)

Create a new instance

Method Summary

Modifier and TypeMethod and Description
public CompositeByteBuf
compositeDirectBuffer(int maxNumComponents)

Overrides io.netty.buffer.AbstractByteBufAllocator.compositeDirectBuffer.

Implements io.netty.buffer.ByteBufAllocator.compositeDirectBuffer.

Allocate a direct CompositeByteBuf with the given maximum number of components that can be stored in it.
public CompositeByteBuf
compositeHeapBuffer(int maxNumComponents)

Overrides io.netty.buffer.AbstractByteBufAllocator.compositeHeapBuffer.

Implements io.netty.buffer.ByteBufAllocator.compositeHeapBuffer.

Allocate a heap CompositeByteBuf with the given maximum number of components that can be stored in it.
pack-priv void
decrementDirect(int amount)

pack-priv void
decrementHeap(int amount)

pack-priv void
incrementDirect(int amount)

pack-priv void
incrementHeap(int amount)

public boolean
public ByteBufAllocatorMetric
protected ByteBuf
newDirectBuffer(int initialCapacity, int maxCapacity)

Implements abstract io.netty.buffer.AbstractByteBufAllocator.newDirectBuffer.

Create a direct ByteBuf with the given initialCapacity and maxCapacity.
protected ByteBuf
newHeapBuffer(int initialCapacity, int maxCapacity)

Implements abstract io.netty.buffer.AbstractByteBufAllocator.newHeapBuffer.

Create a heap ByteBuf with the given initialCapacity and maxCapacity.
Inherited from io.netty.buffer.AbstractByteBufAllocator:
bufferbufferbuffercalculateNewCapacitycompositeBuffercompositeBuffercompositeDirectBuffercompositeHeapBufferdirectBufferdirectBufferdirectBufferheapBufferheapBufferheapBufferioBufferioBufferioBuffertoLeakAwareBuffertoLeakAwareBuffertoString

Field Detail

DEFAULTback to summary
public static final UnpooledByteBufAllocator DEFAULT

Hides io.netty.buffer.ByteBufAllocator.DEFAULT.

Default instance which uses leak-detection for direct buffers.

disableLeakDetectorback to summary
private final boolean disableLeakDetector
metricback to summary
private final UnpooledByteBufAllocator.UnpooledByteBufAllocatorMetric metric
noCleanerback to summary
private final boolean noCleaner

Constructor Detail

UnpooledByteBufAllocatorback to summary
public UnpooledByteBufAllocator(boolean preferDirect)

Create a new instance which uses leak-detection for direct buffers.

Parameters
preferDirect:boolean

true if buffer(int) should try to allocate a direct buffer rather than a heap buffer

UnpooledByteBufAllocatorback to summary
public UnpooledByteBufAllocator(boolean preferDirect, boolean disableLeakDetector)

Create a new instance

Parameters
preferDirect:boolean

true if buffer(int) should try to allocate a direct buffer rather than a heap buffer

disableLeakDetector:boolean

true if the leak-detection should be disabled completely for this allocator. This can be useful if the user just want to depend on the GC to handle direct buffers when not explicit released.

UnpooledByteBufAllocatorback to summary
public UnpooledByteBufAllocator(boolean preferDirect, boolean disableLeakDetector, boolean tryNoCleaner)

Create a new instance

Parameters
preferDirect:boolean

true if buffer(int) should try to allocate a direct buffer rather than a heap buffer

disableLeakDetector:boolean

true if the leak-detection should be disabled completely for this allocator. This can be useful if the user just want to depend on the GC to handle direct buffers when not explicit released.

tryNoCleaner:boolean

true if we should try to use PlatformDependent#allocateDirectNoCleaner(int) to allocate direct memory.

Method Detail

compositeDirectBufferback to summary
public CompositeByteBuf compositeDirectBuffer(int maxNumComponents)

Overrides io.netty.buffer.AbstractByteBufAllocator.compositeDirectBuffer.

Implements io.netty.buffer.ByteBufAllocator.compositeDirectBuffer.

Doc from io.netty.buffer.ByteBufAllocator.compositeDirectBuffer.

Allocate a direct CompositeByteBuf with the given maximum number of components that can be stored in it.

Annotations
@Override
compositeHeapBufferback to summary
public CompositeByteBuf compositeHeapBuffer(int maxNumComponents)

Overrides io.netty.buffer.AbstractByteBufAllocator.compositeHeapBuffer.

Implements io.netty.buffer.ByteBufAllocator.compositeHeapBuffer.

Doc from io.netty.buffer.ByteBufAllocator.compositeHeapBuffer.

Allocate a heap CompositeByteBuf with the given maximum number of components that can be stored in it.

Annotations
@Override
decrementDirectback to summary
pack-priv void decrementDirect(int amount)
decrementHeapback to summary
pack-priv void decrementHeap(int amount)
incrementDirectback to summary
pack-priv void incrementDirect(int amount)
incrementHeapback to summary
pack-priv void incrementHeap(int amount)
isDirectBufferPooledback to summary
public boolean isDirectBufferPooled()

Implements io.netty.buffer.ByteBufAllocator.isDirectBufferPooled.

Doc from io.netty.buffer.ByteBufAllocator.isDirectBufferPooled.

Returns true if direct ByteBuf's are pooled

Annotations
@Override
metricback to summary
public ByteBufAllocatorMetric metric()

Implements io.netty.buffer.ByteBufAllocatorMetricProvider.metric.

Doc from io.netty.buffer.ByteBufAllocatorMetricProvider.metric.

Returns a ByteBufAllocatorMetric for a ByteBufAllocator.

Annotations
@Override
newDirectBufferback to summary
protected ByteBuf newDirectBuffer(int initialCapacity, int maxCapacity)

Implements abstract io.netty.buffer.AbstractByteBufAllocator.newDirectBuffer.

Doc from io.netty.buffer.AbstractByteBufAllocator.newDirectBuffer.

Create a direct ByteBuf with the given initialCapacity and maxCapacity.

Annotations
@Override
newHeapBufferback to summary
protected ByteBuf newHeapBuffer(int initialCapacity, int maxCapacity)

Implements abstract io.netty.buffer.AbstractByteBufAllocator.newHeapBuffer.

Doc from io.netty.buffer.AbstractByteBufAllocator.newHeapBuffer.

Create a heap ByteBuf with the given initialCapacity and maxCapacity.

Annotations
@Override
io.netty.buffer back to summary

private final Class UnpooledByteBufAllocator.InstrumentedUnpooledDirectByteBuf

extends UnpooledDirectByteBuf
Class Inheritance

Field Summary

Inherited from io.netty.buffer.UnpooledDirectByteBuf:
buffer

Constructor Summary

AccessConstructor and Description
pack-priv
InstrumentedUnpooledDirectByteBuf(UnpooledByteBufAllocator alloc, int initialCapacity, int maxCapacity)

Method Summary

Modifier and TypeMethod and Description
protected ByteBuffer
allocateDirect(int initialCapacity)

Overrides io.netty.buffer.UnpooledDirectByteBuf.allocateDirect.

Allocate a new direct ByteBuffer with the given initialCapacity.
protected void
Inherited from io.netty.buffer.UnpooledDirectByteBuf:
_getByte_getInt_getIntLE_getLong_getLongLE_getShort_getShortLE_getUnsignedMedium_getUnsignedMediumLE_setByte_setInt_setIntLE_setLong_setLongLE_setMedium_setMediumLE_setShort_setShortLEallocarrayarrayOffsetcapacitycapacitycopydeallocategetBytegetBytesgetBytesgetBytesgetBytesgetBytesgetBytesgetBytesgetBytesgetBytesgetIntgetLonggetShortgetUnsignedMediumhasArrayhasMemoryAddressinternalNioBufferisContiguousisDirectmemoryAddressnioBuffernioBufferCountnioBuffersorderreadBytesreadBytesreadBytesreadBytesreadBytessetBytesetByteBuffersetBytessetBytessetBytessetBytessetBytessetBytessetIntsetLongsetMediumsetShortunwrap

Constructor Detail

InstrumentedUnpooledDirectByteBufback to summary
pack-priv InstrumentedUnpooledDirectByteBuf(UnpooledByteBufAllocator alloc, int initialCapacity, int maxCapacity)

Method Detail

allocateDirectback to summary
protected ByteBuffer allocateDirect(int initialCapacity)

Overrides io.netty.buffer.UnpooledDirectByteBuf.allocateDirect.

Doc from io.netty.buffer.UnpooledDirectByteBuf.allocateDirect.

Allocate a new direct ByteBuffer with the given initialCapacity.

Annotations
@Override
freeDirectback to summary
protected void freeDirect(ByteBuffer buffer)

Overrides io.netty.buffer.UnpooledDirectByteBuf.freeDirect.

Doc from io.netty.buffer.UnpooledDirectByteBuf.freeDirect.

Free a direct ByteBuffer

Annotations
@Override
io.netty.buffer back to summary

private final Class UnpooledByteBufAllocator.InstrumentedUnpooledHeapByteBuf

extends UnpooledHeapByteBuf
Class Inheritance

Field Summary

Inherited from io.netty.buffer.UnpooledHeapByteBuf:
array

Constructor Summary

AccessConstructor and Description
pack-priv
InstrumentedUnpooledHeapByteBuf(UnpooledByteBufAllocator alloc, int initialCapacity, int maxCapacity)

Method Summary

Modifier and TypeMethod and Description
protected byte[]
protected void
Inherited from io.netty.buffer.UnpooledHeapByteBuf:
_getByte_getInt_getIntLE_getLong_getLongLE_getShort_getShortLE_getUnsignedMedium_getUnsignedMediumLE_setByte_setInt_setIntLE_setLong_setLongLE_setMedium_setMediumLE_setShort_setShortLEallocarrayarrayOffsetcapacitycapacitycopydeallocategetBytegetBytesgetBytesgetBytesgetBytesgetBytesgetBytesgetIntgetIntLEgetLonggetLongLEgetShortgetShortLEgetUnsignedMediumgetUnsignedMediumLEhasArrayhasMemoryAddressinternalNioBufferisContiguousisDirectmemoryAddressnioBuffernioBufferCountnioBuffersorderreadBytesreadBytessetBytesetBytessetBytessetBytessetBytessetBytessetBytessetIntsetIntLEsetLongsetLongLEsetMediumsetMediumLEsetShortsetShortLEunwrap

Constructor Detail

InstrumentedUnpooledHeapByteBufback to summary
pack-priv InstrumentedUnpooledHeapByteBuf(UnpooledByteBufAllocator alloc, int initialCapacity, int maxCapacity)

Method Detail

allocateArrayback to summary
protected byte[] allocateArray(int initialCapacity)

Overrides io.netty.buffer.UnpooledHeapByteBuf.allocateArray.

Annotations
@Override
freeArrayback to summary
protected void freeArray(byte[] array)

Overrides io.netty.buffer.UnpooledHeapByteBuf.freeArray.

Annotations
@Override
io.netty.buffer back to summary

private final Class UnpooledByteBufAllocator.InstrumentedUnpooledUnsafeDirectByteBuf

extends UnpooledUnsafeDirectByteBuf
Class Inheritance

Field Summary

Inherited from io.netty.buffer.UnpooledUnsafeDirectByteBuf:
memoryAddress

Constructor Summary

AccessConstructor and Description
pack-priv
InstrumentedUnpooledUnsafeDirectByteBuf(UnpooledByteBufAllocator alloc, int initialCapacity, int maxCapacity)

Method Summary

Modifier and TypeMethod and Description
protected ByteBuffer
allocateDirect(int initialCapacity)

Overrides io.netty.buffer.UnpooledDirectByteBuf.allocateDirect.

Allocate a new direct ByteBuffer with the given initialCapacity.
protected void
Inherited from io.netty.buffer.UnpooledUnsafeDirectByteBuf:
_getByte_getInt_getIntLE_getLong_getLongLE_getShort_getShortLE_getUnsignedMedium_getUnsignedMediumLE_setByte_setInt_setIntLE_setLong_setLongLE_setMedium_setMediumLE_setShort_setShortLEaddrcopygetBytegetBytesgetBytesgetBytesgetBytesgetIntgetLonggetShortgetUnsignedMediumhasMemoryAddressmemoryAddressnewSwappedByteBufsetBytesetByteBuffersetBytessetBytessetBytessetBytessetIntsetLongsetMediumsetShortsetZerowriteZero

Constructor Detail

InstrumentedUnpooledUnsafeDirectByteBufback to summary
pack-priv InstrumentedUnpooledUnsafeDirectByteBuf(UnpooledByteBufAllocator alloc, int initialCapacity, int maxCapacity)

Method Detail

allocateDirectback to summary
protected ByteBuffer allocateDirect(int initialCapacity)

Overrides io.netty.buffer.UnpooledDirectByteBuf.allocateDirect.

Doc from io.netty.buffer.UnpooledDirectByteBuf.allocateDirect.

Allocate a new direct ByteBuffer with the given initialCapacity.

Annotations
@Override
freeDirectback to summary
protected void freeDirect(ByteBuffer buffer)

Overrides io.netty.buffer.UnpooledDirectByteBuf.freeDirect.

Doc from io.netty.buffer.UnpooledDirectByteBuf.freeDirect.

Free a direct ByteBuffer

Annotations
@Override
io.netty.buffer back to summary

private final Class UnpooledByteBufAllocator.InstrumentedUnpooledUnsafeHeapByteBuf

extends UnpooledUnsafeHeapByteBuf
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv
InstrumentedUnpooledUnsafeHeapByteBuf(UnpooledByteBufAllocator alloc, int initialCapacity, int maxCapacity)

Method Summary

Modifier and TypeMethod and Description
protected byte[]
protected void
Inherited from io.netty.buffer.UnpooledUnsafeHeapByteBuf:
_getByte_getInt_getIntLE_getLong_getLongLE_getShort_getShortLE_getUnsignedMedium_getUnsignedMediumLE_setByte_setInt_setIntLE_setLong_setLongLE_setMedium_setMediumLE_setShort_setShortLEgetBytegetIntgetIntLEgetLonggetLongLEgetShortgetShortLEgetUnsignedMediumgetUnsignedMediumLEnewSwappedByteBufsetBytesetIntsetIntLEsetLongsetLongLEsetMediumsetMediumLEsetShortsetShortLEsetZerowriteZero

Constructor Detail

InstrumentedUnpooledUnsafeHeapByteBufback to summary
pack-priv InstrumentedUnpooledUnsafeHeapByteBuf(UnpooledByteBufAllocator alloc, int initialCapacity, int maxCapacity)

Method Detail

allocateArrayback to summary
protected byte[] allocateArray(int initialCapacity)

Overrides io.netty.buffer.UnpooledUnsafeHeapByteBuf.allocateArray.

Annotations
@Override
freeArrayback to summary
protected void freeArray(byte[] array)

Overrides io.netty.buffer.UnpooledHeapByteBuf.freeArray.

Annotations
@Override
io.netty.buffer back to summary

private final Class UnpooledByteBufAllocator.InstrumentedUnpooledUnsafeNoCleanerDirectByteBuf

extends UnpooledUnsafeNoCleanerDirectByteBuf
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected ByteBuffer
allocateDirect(int initialCapacity)

Overrides io.netty.buffer.UnpooledUnsafeNoCleanerDirectByteBuf.allocateDirect.

Allocate a new direct ByteBuffer with the given initialCapacity.
protected void
pack-priv ByteBuffer
Inherited from io.netty.buffer.UnpooledUnsafeNoCleanerDirectByteBuf:
capacity

Constructor Detail

InstrumentedUnpooledUnsafeNoCleanerDirectByteBufback to summary
pack-priv InstrumentedUnpooledUnsafeNoCleanerDirectByteBuf(UnpooledByteBufAllocator alloc, int initialCapacity, int maxCapacity)

Method Detail

allocateDirectback to summary
protected ByteBuffer allocateDirect(int initialCapacity)

Overrides io.netty.buffer.UnpooledUnsafeNoCleanerDirectByteBuf.allocateDirect.

Doc from io.netty.buffer.UnpooledDirectByteBuf.allocateDirect.

Allocate a new direct ByteBuffer with the given initialCapacity.

Annotations
@Override
freeDirectback to summary
protected void freeDirect(ByteBuffer buffer)

Overrides io.netty.buffer.UnpooledUnsafeNoCleanerDirectByteBuf.freeDirect.

Doc from io.netty.buffer.UnpooledDirectByteBuf.freeDirect.

Free a direct ByteBuffer

Annotations
@Override
reallocateDirectback to summary
pack-priv ByteBuffer reallocateDirect(ByteBuffer oldBuffer, int initialCapacity)

Overrides io.netty.buffer.UnpooledUnsafeNoCleanerDirectByteBuf.reallocateDirect.

Annotations
@Override
io.netty.buffer back to summary

private final Class UnpooledByteBufAllocator.UnpooledByteBufAllocatorMetric

extends Object
implements ByteBufAllocatorMetric
Class Inheritance
  • java.lang.Object
  • io.netty.buffer.UnpooledByteBufAllocator.UnpooledByteBufAllocatorMetric
All Implemented Interfaces
io.netty.buffer.ByteBufAllocatorMetric

Field Summary

Modifier and TypeField and Description
pack-priv final LongCounter
pack-priv final LongCounter

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public long
usedDirectMemory()

Implements io.netty.buffer.ByteBufAllocatorMetric.usedDirectMemory.

Returns the number of bytes of direct memory used by a ByteBufAllocator or -1 if unknown.
public long
usedHeapMemory()

Implements io.netty.buffer.ByteBufAllocatorMetric.usedHeapMemory.

Returns the number of bytes of heap memory used by a ByteBufAllocator or -1 if unknown.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

directCounterback to summary
pack-priv final LongCounter directCounter
heapCounterback to summary
pack-priv final LongCounter heapCounter

Constructor Detail

UnpooledByteBufAllocatorMetricback to summary
private UnpooledByteBufAllocatorMetric()

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
usedDirectMemoryback to summary
public long usedDirectMemory()

Implements io.netty.buffer.ByteBufAllocatorMetric.usedDirectMemory.

Doc from io.netty.buffer.ByteBufAllocatorMetric.usedDirectMemory.

Returns the number of bytes of direct memory used by a ByteBufAllocator or -1 if unknown.

Annotations
@Override
usedHeapMemoryback to summary
public long usedHeapMemory()

Implements io.netty.buffer.ByteBufAllocatorMetric.usedHeapMemory.

Doc from io.netty.buffer.ByteBufAllocatorMetric.usedHeapMemory.

Returns the number of bytes of heap memory used by a ByteBufAllocator or -1 if unknown.

Annotations
@Override