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 Modifier and Type Field Description static ByteBufAllocator
DEFAULT
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ByteBuf
buffer()
Allocate aByteBuf
.ByteBuf
buffer(int initialCapacity)
Allocate aByteBuf
with the given initial capacity.ByteBuf
buffer(int initialCapacity, int maxCapacity)
Allocate aByteBuf
with the given initial capacity and the given maximal capacity.int
calculateNewCapacity(int minNewCapacity, int maxCapacity)
CompositeByteBuf
compositeBuffer()
Allocate aCompositeByteBuf
.CompositeByteBuf
compositeBuffer(int maxNumComponents)
Allocate aCompositeByteBuf
with the given maximum number of components that can be stored in it.CompositeByteBuf
compositeDirectBuffer()
Allocate a directCompositeByteBuf
.CompositeByteBuf
compositeDirectBuffer(int maxNumComponents)
Allocate a directCompositeByteBuf
with the given maximum number of components that can be stored in it.CompositeByteBuf
compositeHeapBuffer()
Allocate a heapCompositeByteBuf
.CompositeByteBuf
compositeHeapBuffer(int maxNumComponents)
Allocate a heapCompositeByteBuf
with the given maximum number of components that can be stored in it.ByteBuf
directBuffer()
Allocate a directByteBuf
.ByteBuf
directBuffer(int initialCapacity)
Allocate a directByteBuf
with the given initial capacity.ByteBuf
directBuffer(int initialCapacity, int maxCapacity)
Allocate a directByteBuf
with the given initial capacity and the given maximal capacity.ByteBuf
heapBuffer()
Allocate a heapByteBuf
.ByteBuf
heapBuffer(int initialCapacity)
Allocate a heapByteBuf
with the given initial capacity.ByteBuf
heapBuffer(int initialCapacity, int maxCapacity)
Allocate a heapByteBuf
with the given initial capacity and the given maximal capacity.ByteBuf
ioBuffer()
Allocate aByteBuf
, preferably a direct buffer which is suitable for I/O.ByteBuf
ioBuffer(int initialCapacity)
Allocate aByteBuf
, preferably a direct buffer which is suitable for I/O.ByteBuf
ioBuffer(int initialCapacity, int maxCapacity)
Allocate aByteBuf
, preferably a direct buffer which is suitable for I/O.boolean
isDirectBufferPooled()
Returnstrue
if 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 aByteBuf
with 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 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
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 heapByteBuf
with the given initial capacity.
-
heapBuffer
ByteBuf heapBuffer(int initialCapacity, int maxCapacity)
Allocate a heapByteBuf
with the given initial capacity and the given maximal capacity.
-
directBuffer
ByteBuf directBuffer(int initialCapacity)
Allocate a directByteBuf
with the given initial capacity.
-
directBuffer
ByteBuf directBuffer(int initialCapacity, int maxCapacity)
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
CompositeByteBuf compositeBuffer(int maxNumComponents)
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
CompositeByteBuf compositeHeapBuffer(int maxNumComponents)
Allocate a heapCompositeByteBuf
with 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 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)
-
-