public abstract class AbstractByteBufAllocator extends java.lang.Object implements ByteBufAllocator
ByteBufAllocator
implementation to extend.DEFAULT
限定符 | 构造器和说明 |
---|---|
protected |
AbstractByteBufAllocator()
Instance use heap buffers by default
|
protected |
AbstractByteBufAllocator(boolean preferDirect)
Create new instance
|
限定符和类型 | 方法和说明 |
---|---|
ByteBuf |
buffer()
Allocate a
ByteBuf . |
ByteBuf |
buffer(int initialCapacity)
Allocate a
ByteBuf with the given initial capacity. |
ByteBuf |
buffer(int initialCapacity,
int maxCapacity)
Allocate a
ByteBuf with the given initial capacity and the given
maximal capacity. |
int |
calculateNewCapacity(int minNewCapacity,
int maxCapacity)
|
CompositeByteBuf |
compositeBuffer()
Allocate a
CompositeByteBuf . |
CompositeByteBuf |
compositeBuffer(int maxNumComponents)
Allocate a
CompositeByteBuf with the given maximum number of components that can be stored in it. |
CompositeByteBuf |
compositeDirectBuffer()
Allocate a direct
CompositeByteBuf . |
CompositeByteBuf |
compositeDirectBuffer(int maxNumComponents)
Allocate a direct
CompositeByteBuf with the given maximum number of components that can be stored in it. |
CompositeByteBuf |
compositeHeapBuffer()
Allocate a heap
CompositeByteBuf . |
CompositeByteBuf |
compositeHeapBuffer(int maxNumComponents)
Allocate a heap
CompositeByteBuf with the given maximum number of components that can be stored in it. |
ByteBuf |
directBuffer()
Allocate a direct
ByteBuf . |
ByteBuf |
directBuffer(int initialCapacity)
Allocate a direct
ByteBuf with the given initial capacity. |
ByteBuf |
directBuffer(int initialCapacity,
int maxCapacity)
Allocate a direct
ByteBuf with the given initial capacity and the given
maximal capacity. |
ByteBuf |
heapBuffer()
Allocate a heap
ByteBuf . |
ByteBuf |
heapBuffer(int initialCapacity)
Allocate a heap
ByteBuf with the given initial capacity. |
ByteBuf |
heapBuffer(int initialCapacity,
int maxCapacity)
Allocate a heap
ByteBuf with the given initial capacity and the given
maximal capacity. |
ByteBuf |
ioBuffer()
Allocate a
ByteBuf , preferably a direct buffer which is suitable for I/O. |
ByteBuf |
ioBuffer(int initialCapacity)
Allocate a
ByteBuf , preferably a direct buffer which is suitable for I/O. |
ByteBuf |
ioBuffer(int initialCapacity,
int maxCapacity)
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 |
toLeakAwareBuffer(ByteBuf buf) |
protected static CompositeByteBuf |
toLeakAwareBuffer(CompositeByteBuf buf) |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isDirectBufferPooled
protected AbstractByteBufAllocator()
protected AbstractByteBufAllocator(boolean preferDirect)
preferDirect
- true
if buffer(int)
should try to allocate a direct buffer rather than
a heap bufferprotected static CompositeByteBuf toLeakAwareBuffer(CompositeByteBuf buf)
public ByteBuf buffer()
ByteBufAllocator
ByteBuf
. If it is a direct or heap buffer
depends on the actual implementation.buffer
在接口中 ByteBufAllocator
public ByteBuf buffer(int initialCapacity)
ByteBufAllocator
ByteBuf
with the given initial capacity.
If it is a direct or heap buffer depends on the actual implementation.buffer
在接口中 ByteBufAllocator
public ByteBuf buffer(int initialCapacity, int maxCapacity)
ByteBufAllocator
ByteBuf
with the given initial capacity and the given
maximal capacity. If it is a direct or heap buffer depends on the actual
implementation.buffer
在接口中 ByteBufAllocator
public ByteBuf ioBuffer()
ByteBufAllocator
ByteBuf
, preferably a direct buffer which is suitable for I/O.ioBuffer
在接口中 ByteBufAllocator
public ByteBuf ioBuffer(int initialCapacity)
ByteBufAllocator
ByteBuf
, preferably a direct buffer which is suitable for I/O.ioBuffer
在接口中 ByteBufAllocator
public ByteBuf ioBuffer(int initialCapacity, int maxCapacity)
ByteBufAllocator
ByteBuf
, preferably a direct buffer which is suitable for I/O.ioBuffer
在接口中 ByteBufAllocator
public ByteBuf heapBuffer()
ByteBufAllocator
ByteBuf
.heapBuffer
在接口中 ByteBufAllocator
public ByteBuf heapBuffer(int initialCapacity)
ByteBufAllocator
ByteBuf
with the given initial capacity.heapBuffer
在接口中 ByteBufAllocator
public ByteBuf heapBuffer(int initialCapacity, int maxCapacity)
ByteBufAllocator
ByteBuf
with the given initial capacity and the given
maximal capacity.heapBuffer
在接口中 ByteBufAllocator
public ByteBuf directBuffer()
ByteBufAllocator
ByteBuf
.directBuffer
在接口中 ByteBufAllocator
public ByteBuf directBuffer(int initialCapacity)
ByteBufAllocator
ByteBuf
with the given initial capacity.directBuffer
在接口中 ByteBufAllocator
public ByteBuf directBuffer(int initialCapacity, int maxCapacity)
ByteBufAllocator
ByteBuf
with the given initial capacity and the given
maximal capacity.directBuffer
在接口中 ByteBufAllocator
public CompositeByteBuf compositeBuffer()
ByteBufAllocator
CompositeByteBuf
.
If it is a direct or heap buffer depends on the actual implementation.compositeBuffer
在接口中 ByteBufAllocator
public CompositeByteBuf compositeBuffer(int maxNumComponents)
ByteBufAllocator
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.compositeBuffer
在接口中 ByteBufAllocator
public CompositeByteBuf compositeHeapBuffer()
ByteBufAllocator
CompositeByteBuf
.compositeHeapBuffer
在接口中 ByteBufAllocator
public CompositeByteBuf compositeHeapBuffer(int maxNumComponents)
ByteBufAllocator
CompositeByteBuf
with the given maximum number of components that can be stored in it.compositeHeapBuffer
在接口中 ByteBufAllocator
public CompositeByteBuf compositeDirectBuffer()
ByteBufAllocator
CompositeByteBuf
.compositeDirectBuffer
在接口中 ByteBufAllocator
public CompositeByteBuf compositeDirectBuffer(int maxNumComponents)
ByteBufAllocator
CompositeByteBuf
with the given maximum number of components that can be stored in it.compositeDirectBuffer
在接口中 ByteBufAllocator
protected abstract ByteBuf newHeapBuffer(int initialCapacity, int maxCapacity)
ByteBuf
with the given initialCapacity and maxCapacity.protected abstract ByteBuf newDirectBuffer(int initialCapacity, int maxCapacity)
ByteBuf
with the given initialCapacity and maxCapacity.public java.lang.String toString()
toString
在类中 java.lang.Object
public int calculateNewCapacity(int minNewCapacity, int maxCapacity)
ByteBufAllocator
ByteBuf
that is used when a ByteBuf
needs to expand by the
minNewCapacity
with maxCapacity
as upper-bound.calculateNewCapacity
在接口中 ByteBufAllocator