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