Package io.netty.buffer
Interface ByteBufAllocator
- All Known Implementing Classes:
AbstractByteBufAllocator,AdaptiveByteBufAllocator,PooledByteBufAllocator,PreferHeapByteBufAllocator,PreferredDirectByteBufAllocator,UnpooledByteBufAllocator
public interface ByteBufAllocator
Implementations are responsible to allocate buffers. Implementations of this interface are expected to be
thread-safe.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbuffer()Allocate aByteBuf.buffer(int initialCapacity) Allocate aByteBufwith the given initial capacity.buffer(int initialCapacity, int maxCapacity) Allocate aByteBufwith the given initial capacity and the given maximal capacity.intcalculateNewCapacity(int minNewCapacity, int maxCapacity) Allocate aCompositeByteBuf.compositeBuffer(int maxNumComponents) Allocate aCompositeByteBufwith the given maximum number of components that can be stored in it.Allocate a directCompositeByteBuf.compositeDirectBuffer(int maxNumComponents) Allocate a directCompositeByteBufwith the given maximum number of components that can be stored in it.Allocate a heapCompositeByteBuf.compositeHeapBuffer(int maxNumComponents) Allocate a heapCompositeByteBufwith the given maximum number of components that can be stored in it.Allocate a directByteBuf.directBuffer(int initialCapacity) Allocate a directByteBufwith the given initial capacity.directBuffer(int initialCapacity, int maxCapacity) Allocate a directByteBufwith the given initial capacity and the given maximal capacity.Allocate a heapByteBuf.heapBuffer(int initialCapacity) Allocate a heapByteBufwith the given initial capacity.heapBuffer(int initialCapacity, int maxCapacity) Allocate a heapByteBufwith the given initial capacity and the given maximal capacity.ioBuffer()Allocate aByteBuf, preferably a direct buffer which is suitable for I/O.ioBuffer(int initialCapacity) Allocate aByteBuf, preferably a direct buffer which is suitable for I/O.ioBuffer(int initialCapacity, int maxCapacity) Allocate aByteBuf, preferably a direct buffer which is suitable for I/O.booleanReturnstrueif directByteBuf's are pooled
-
Field Details
-
DEFAULT
-
-
Method Details
-
buffer
ByteBuf buffer()Allocate aByteBuf. If it is a direct or heap buffer depends on the actual implementation. -
buffer
Allocate aByteBufwith the given initial capacity. If it is a direct or heap buffer depends on the actual implementation. -
buffer
Allocate aByteBufwith the given initial capacity and the given maximal capacity. If it is a direct or heap buffer depends on the actual implementation. -
ioBuffer
ByteBuf ioBuffer()Allocate aByteBuf, preferably a direct buffer which is suitable for I/O. -
ioBuffer
Allocate aByteBuf, preferably a direct buffer which is suitable for I/O. -
ioBuffer
Allocate aByteBuf, preferably a direct buffer which is suitable for I/O. -
heapBuffer
ByteBuf heapBuffer()Allocate a heapByteBuf. -
heapBuffer
Allocate a heapByteBufwith the given initial capacity. -
heapBuffer
Allocate a heapByteBufwith the given initial capacity and the given maximal capacity. -
directBuffer
ByteBuf directBuffer()Allocate a directByteBuf. -
directBuffer
Allocate a directByteBufwith the given initial capacity. -
directBuffer
Allocate a directByteBufwith the given initial capacity and the given maximal capacity. -
compositeBuffer
CompositeByteBuf compositeBuffer()Allocate aCompositeByteBuf. If it is a direct or heap buffer depends on the actual implementation. -
compositeBuffer
Allocate aCompositeByteBufwith 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. -
compositeHeapBuffer
CompositeByteBuf compositeHeapBuffer()Allocate a heapCompositeByteBuf. -
compositeHeapBuffer
Allocate a heapCompositeByteBufwith the given maximum number of components that can be stored in it. -
compositeDirectBuffer
CompositeByteBuf compositeDirectBuffer()Allocate a directCompositeByteBuf. -
compositeDirectBuffer
Allocate a directCompositeByteBufwith the given maximum number of components that can be stored in it. -
isDirectBufferPooled
boolean isDirectBufferPooled()Returnstrueif directByteBuf's are pooled -
calculateNewCapacity
int calculateNewCapacity(int minNewCapacity, int maxCapacity)
-