Package io.netty.buffer
Interface ByteBufAllocator
- All Known Implementing Classes:
AbstractByteBufAllocator
,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 aByteBuf
with the given initial capacity.buffer
(int initialCapacity, int maxCapacity) Allocate aByteBuf
with the given initial capacity and the given maximal capacity.int
calculateNewCapacity
(int minNewCapacity, int maxCapacity) Allocate aCompositeByteBuf
.compositeBuffer
(int maxNumComponents) Allocate aCompositeByteBuf
with the given maximum number of components that can be stored in it.Allocate a directCompositeByteBuf
.compositeDirectBuffer
(int maxNumComponents) Allocate a directCompositeByteBuf
with the given maximum number of components that can be stored in it.Allocate a heapCompositeByteBuf
.compositeHeapBuffer
(int maxNumComponents) Allocate a heapCompositeByteBuf
with the given maximum number of components that can be stored in it.Allocate a directByteBuf
.directBuffer
(int initialCapacity) Allocate a directByteBuf
with the given initial capacity.directBuffer
(int initialCapacity, int maxCapacity) Allocate a directByteBuf
with the given initial capacity and the given maximal capacity.Allocate a heapByteBuf
.heapBuffer
(int initialCapacity) Allocate a heapByteBuf
with the given initial capacity.heapBuffer
(int initialCapacity, int maxCapacity) Allocate a heapByteBuf
with 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.boolean
Returnstrue
if 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 aByteBuf
with the given initial capacity. If it is a direct or heap buffer depends on the actual implementation. -
buffer
Allocate aByteBuf
with 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 heapByteBuf
with the given initial capacity. -
heapBuffer
Allocate a heapByteBuf
with the given initial capacity and the given maximal capacity. -
directBuffer
ByteBuf directBuffer()Allocate a directByteBuf
. -
directBuffer
Allocate a directByteBuf
with the given initial capacity. -
directBuffer
Allocate a directByteBuf
with 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 aCompositeByteBuf
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. -
compositeHeapBuffer
CompositeByteBuf compositeHeapBuffer()Allocate a heapCompositeByteBuf
. -
compositeHeapBuffer
Allocate a heapCompositeByteBuf
with the given maximum number of components that can be stored in it. -
compositeDirectBuffer
CompositeByteBuf compositeDirectBuffer()Allocate a directCompositeByteBuf
. -
compositeDirectBuffer
Allocate a directCompositeByteBuf
with the given maximum number of components that can be stored in it. -
isDirectBufferPooled
boolean isDirectBufferPooled()Returnstrue
if directByteBuf
's are pooled -
calculateNewCapacity
int calculateNewCapacity(int minNewCapacity, int maxCapacity)
-