Top Description Fields Constructors Methods
io.netty.buffer

public abstract Class AbstractByteBufAllocator

extends Object
implements ByteBufAllocator
Class Inheritance
All Implemented Interfaces
io.netty.buffer.ByteBufAllocator
Known Direct Subclasses
io.netty.buffer.UnpooledByteBufAllocator, io.netty.buffer.PooledByteBufAllocator
Static Imports
io.netty.util.internal.ObjectUtil.checkPositiveOrZero

Skeletal ByteBufAllocator implementation to extend.

Field Summary

Modifier and TypeField and Description
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
private final boolean
private final ByteBuf

Constructor Summary

AccessConstructor and Description
protected
AbstractByteBufAllocator()

Instance use heap buffers by default

protected
AbstractByteBufAllocator(boolean
true if buffer(int) should try to allocate a direct buffer rather than a heap buffer
preferDirect
)

Create new instance

Method Summary

Modifier and TypeMethod and Description
public ByteBuf
public ByteBuf
buffer(int initialCapacity)

Implements io.netty.buffer.ByteBufAllocator.buffer.

Allocate a ByteBuf with the given initial capacity.
public ByteBuf
buffer(int initialCapacity, int maxCapacity)

Implements io.netty.buffer.ByteBufAllocator.buffer.

Allocate a ByteBuf with the given initial capacity and the given maximal capacity.
public int
calculateNewCapacity(int minNewCapacity, int maxCapacity)

Implements io.netty.buffer.ByteBufAllocator.calculateNewCapacity.

Calculate the new capacity of a ByteBuf that is used when a ByteBuf needs to expand by the minNewCapacity with maxCapacity as upper-bound.
public CompositeByteBuf
public CompositeByteBuf
compositeBuffer(int maxNumComponents)

Implements io.netty.buffer.ByteBufAllocator.compositeBuffer.

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

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
public CompositeByteBuf
compositeHeapBuffer(int maxNumComponents)

Implements io.netty.buffer.ByteBufAllocator.compositeHeapBuffer.

Allocate a heap CompositeByteBuf with the given maximum number of components that can be stored in it.
public ByteBuf
public ByteBuf
directBuffer(int initialCapacity)

Implements io.netty.buffer.ByteBufAllocator.directBuffer.

Allocate a direct ByteBuf with the given initial capacity.
public ByteBuf
directBuffer(int initialCapacity, int maxCapacity)

Implements io.netty.buffer.ByteBufAllocator.directBuffer.

Allocate a direct ByteBuf with the given initial capacity and the given maximal capacity.
public ByteBuf
public ByteBuf
heapBuffer(int initialCapacity)

Implements io.netty.buffer.ByteBufAllocator.heapBuffer.

Allocate a heap ByteBuf with the given initial capacity.
public ByteBuf
heapBuffer(int initialCapacity, int maxCapacity)

Implements io.netty.buffer.ByteBufAllocator.heapBuffer.

Allocate a heap ByteBuf with the given initial capacity and the given maximal capacity.
public ByteBuf
ioBuffer()

Implements io.netty.buffer.ByteBufAllocator.ioBuffer.

Allocate a ByteBuf, preferably a direct buffer which is suitable for I/O.
public ByteBuf
ioBuffer(int initialCapacity)

Implements io.netty.buffer.ByteBufAllocator.ioBuffer.

Allocate a ByteBuf, preferably a direct buffer which is suitable for I/O.
public ByteBuf
ioBuffer(int initialCapacity, int maxCapacity)

Implements io.netty.buffer.ByteBufAllocator.ioBuffer.

Allocate a ByteBuf, preferably a direct buffer which is suitable for I/O.
protected abstract ByteBuf
newDirectBuffer(int initialCapacity, int maxCapacity)

Create a direct ByteBuf with the given initialCapacity and maxCapacity.

protected abstract ByteBuf
newHeapBuffer(int initialCapacity, int maxCapacity)

Create a heap ByteBuf with the given initialCapacity and maxCapacity.

protected static ByteBuf
protected static CompositeByteBuf
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
private static void
validate(int initialCapacity, int maxCapacity)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

CALCULATE_THRESHOLDback to summary
pack-priv static final int CALCULATE_THRESHOLD
DEFAULT_INITIAL_CAPACITYback to summary
pack-priv static final int DEFAULT_INITIAL_CAPACITY
DEFAULT_MAX_CAPACITYback to summary
pack-priv static final int DEFAULT_MAX_CAPACITY
DEFAULT_MAX_COMPONENTSback to summary
pack-priv static final int DEFAULT_MAX_COMPONENTS
directByDefaultback to summary
private final boolean directByDefault
emptyBufback to summary
private final ByteBuf emptyBuf

Constructor Detail

AbstractByteBufAllocatorback to summary
protected AbstractByteBufAllocator()

Instance use heap buffers by default

AbstractByteBufAllocatorback to summary
protected AbstractByteBufAllocator(boolean preferDirect)

Create new instance

Parameters
preferDirect:boolean

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

Method Detail

bufferback to summary
public ByteBuf buffer()

Implements io.netty.buffer.ByteBufAllocator.buffer.

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

Allocate a ByteBuf. If it is a direct or heap buffer depends on the actual implementation.

Annotations
@Override
bufferback to summary
public ByteBuf buffer(int initialCapacity)

Implements io.netty.buffer.ByteBufAllocator.buffer.

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

Allocate a ByteBuf with the given initial capacity. If it is a direct or heap buffer depends on the actual implementation.

Annotations
@Override
bufferback to summary
public ByteBuf buffer(int initialCapacity, int maxCapacity)

Implements io.netty.buffer.ByteBufAllocator.buffer.

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

Allocate a ByteBuf with the given initial capacity and the given maximal capacity. If it is a direct or heap buffer depends on the actual implementation.

Annotations
@Override
calculateNewCapacityback to summary
public int calculateNewCapacity(int minNewCapacity, int maxCapacity)

Implements io.netty.buffer.ByteBufAllocator.calculateNewCapacity.

Doc from io.netty.buffer.ByteBufAllocator.calculateNewCapacity.

Calculate the new capacity of a ByteBuf that is used when a ByteBuf needs to expand by the minNewCapacity with maxCapacity as upper-bound.

Annotations
@Override
compositeBufferback to summary
public CompositeByteBuf compositeBuffer()

Implements io.netty.buffer.ByteBufAllocator.compositeBuffer.

Doc from io.netty.buffer.ByteBufAllocator.compositeBuffer.

Allocate a CompositeByteBuf. If it is a direct or heap buffer depends on the actual implementation.

Annotations
@Override
compositeBufferback to summary
public CompositeByteBuf compositeBuffer(int maxNumComponents)

Implements io.netty.buffer.ByteBufAllocator.compositeBuffer.

Doc from io.netty.buffer.ByteBufAllocator.compositeBuffer.

Allocate a CompositeByteBuf with the given maximum number of components that can be stored in it. If it is a direct or heap buffer depends on the actual implementation.

Annotations
@Override
compositeDirectBufferback to summary
public CompositeByteBuf compositeDirectBuffer()

Implements io.netty.buffer.ByteBufAllocator.compositeDirectBuffer.

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

Allocate a direct CompositeByteBuf.

Annotations
@Override
compositeDirectBufferback to summary
public CompositeByteBuf compositeDirectBuffer(int maxNumComponents)

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()

Implements io.netty.buffer.ByteBufAllocator.compositeHeapBuffer.

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

Allocate a heap CompositeByteBuf.

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

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
directBufferback to summary
public ByteBuf directBuffer()

Implements io.netty.buffer.ByteBufAllocator.directBuffer.

Doc from io.netty.buffer.ByteBufAllocator.directBuffer.

Allocate a direct ByteBuf.

Annotations
@Override
directBufferback to summary
public ByteBuf directBuffer(int initialCapacity)

Implements io.netty.buffer.ByteBufAllocator.directBuffer.

Doc from io.netty.buffer.ByteBufAllocator.directBuffer.

Allocate a direct ByteBuf with the given initial capacity.

Annotations
@Override
directBufferback to summary
public ByteBuf directBuffer(int initialCapacity, int maxCapacity)

Implements io.netty.buffer.ByteBufAllocator.directBuffer.

Doc from io.netty.buffer.ByteBufAllocator.directBuffer.

Allocate a direct ByteBuf with the given initial capacity and the given maximal capacity.

Annotations
@Override
heapBufferback to summary
public ByteBuf heapBuffer()

Implements io.netty.buffer.ByteBufAllocator.heapBuffer.

Doc from io.netty.buffer.ByteBufAllocator.heapBuffer.

Allocate a heap ByteBuf.

Annotations
@Override
heapBufferback to summary
public ByteBuf heapBuffer(int initialCapacity)

Implements io.netty.buffer.ByteBufAllocator.heapBuffer.

Doc from io.netty.buffer.ByteBufAllocator.heapBuffer.

Allocate a heap ByteBuf with the given initial capacity.

Annotations
@Override
heapBufferback to summary
public ByteBuf heapBuffer(int initialCapacity, int maxCapacity)

Implements io.netty.buffer.ByteBufAllocator.heapBuffer.

Doc from io.netty.buffer.ByteBufAllocator.heapBuffer.

Allocate a heap ByteBuf with the given initial capacity and the given maximal capacity.

Annotations
@Override
ioBufferback to summary
public ByteBuf ioBuffer()

Implements io.netty.buffer.ByteBufAllocator.ioBuffer.

Doc from io.netty.buffer.ByteBufAllocator.ioBuffer.

Allocate a ByteBuf, preferably a direct buffer which is suitable for I/O.

Annotations
@Override
ioBufferback to summary
public ByteBuf ioBuffer(int initialCapacity)

Implements io.netty.buffer.ByteBufAllocator.ioBuffer.

Doc from io.netty.buffer.ByteBufAllocator.ioBuffer.

Allocate a ByteBuf, preferably a direct buffer which is suitable for I/O.

Annotations
@Override
ioBufferback to summary
public ByteBuf ioBuffer(int initialCapacity, int maxCapacity)

Implements io.netty.buffer.ByteBufAllocator.ioBuffer.

Doc from io.netty.buffer.ByteBufAllocator.ioBuffer.

Allocate a ByteBuf, preferably a direct buffer which is suitable for I/O.

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

Create a direct ByteBuf with the given initialCapacity and maxCapacity.

newHeapBufferback to summary
protected abstract ByteBuf newHeapBuffer(int initialCapacity, int maxCapacity)

Create a heap ByteBuf with the given initialCapacity and maxCapacity.

toLeakAwareBufferback to summary
protected static ByteBuf toLeakAwareBuffer(ByteBuf buf)
toLeakAwareBufferback to summary
protected static CompositeByteBuf toLeakAwareBuffer(CompositeByteBuf buf)
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
validateback to summary
private static void validate(int initialCapacity, int maxCapacity)