Package io.netty.channel
Class PreferHeapByteBufAllocator
- java.lang.Object
-
- io.netty.channel.PreferHeapByteBufAllocator
-
- All Implemented Interfaces:
ByteBufAllocator
@UnstableApi public final class PreferHeapByteBufAllocator extends java.lang.Object implements ByteBufAllocator
Wraps anotherByteBufAllocatorand use heapbuffers everywhere except when a direct buffer is explicit requested.
-
-
Field Summary
-
Fields inherited from interface io.netty.buffer.ByteBufAllocator
DEFAULT
-
-
Constructor Summary
Constructors Constructor Description PreferHeapByteBufAllocator(ByteBufAllocator allocator)
-
Method Summary
All Methods Instance Methods Concrete 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
-
-
-
Constructor Detail
-
PreferHeapByteBufAllocator
public PreferHeapByteBufAllocator(ByteBufAllocator allocator)
-
-
Method Detail
-
buffer
public ByteBuf buffer()
Description copied from interface:ByteBufAllocatorAllocate aByteBuf. If it is a direct or heap buffer depends on the actual implementation.- Specified by:
bufferin interfaceByteBufAllocator
-
buffer
public ByteBuf buffer(int initialCapacity)
Description copied from interface:ByteBufAllocatorAllocate aByteBufwith the given initial capacity. If it is a direct or heap buffer depends on the actual implementation.- Specified by:
bufferin interfaceByteBufAllocator
-
buffer
public ByteBuf buffer(int initialCapacity, int maxCapacity)
Description copied from interface:ByteBufAllocatorAllocate aByteBufwith the given initial capacity and the given maximal capacity. If it is a direct or heap buffer depends on the actual implementation.- Specified by:
bufferin interfaceByteBufAllocator
-
ioBuffer
public ByteBuf ioBuffer()
Description copied from interface:ByteBufAllocatorAllocate aByteBuf, preferably a direct buffer which is suitable for I/O.- Specified by:
ioBufferin interfaceByteBufAllocator
-
ioBuffer
public ByteBuf ioBuffer(int initialCapacity)
Description copied from interface:ByteBufAllocatorAllocate aByteBuf, preferably a direct buffer which is suitable for I/O.- Specified by:
ioBufferin interfaceByteBufAllocator
-
ioBuffer
public ByteBuf ioBuffer(int initialCapacity, int maxCapacity)
Description copied from interface:ByteBufAllocatorAllocate aByteBuf, preferably a direct buffer which is suitable for I/O.- Specified by:
ioBufferin interfaceByteBufAllocator
-
heapBuffer
public ByteBuf heapBuffer()
Description copied from interface:ByteBufAllocatorAllocate a heapByteBuf.- Specified by:
heapBufferin interfaceByteBufAllocator
-
heapBuffer
public ByteBuf heapBuffer(int initialCapacity)
Description copied from interface:ByteBufAllocatorAllocate a heapByteBufwith the given initial capacity.- Specified by:
heapBufferin interfaceByteBufAllocator
-
heapBuffer
public ByteBuf heapBuffer(int initialCapacity, int maxCapacity)
Description copied from interface:ByteBufAllocatorAllocate a heapByteBufwith the given initial capacity and the given maximal capacity.- Specified by:
heapBufferin interfaceByteBufAllocator
-
directBuffer
public ByteBuf directBuffer()
Description copied from interface:ByteBufAllocatorAllocate a directByteBuf.- Specified by:
directBufferin interfaceByteBufAllocator
-
directBuffer
public ByteBuf directBuffer(int initialCapacity)
Description copied from interface:ByteBufAllocatorAllocate a directByteBufwith the given initial capacity.- Specified by:
directBufferin interfaceByteBufAllocator
-
directBuffer
public ByteBuf directBuffer(int initialCapacity, int maxCapacity)
Description copied from interface:ByteBufAllocatorAllocate a directByteBufwith the given initial capacity and the given maximal capacity.- Specified by:
directBufferin interfaceByteBufAllocator
-
compositeBuffer
public CompositeByteBuf compositeBuffer()
Description copied from interface:ByteBufAllocatorAllocate aCompositeByteBuf. If it is a direct or heap buffer depends on the actual implementation.- Specified by:
compositeBufferin interfaceByteBufAllocator
-
compositeBuffer
public CompositeByteBuf compositeBuffer(int maxNumComponents)
Description copied from interface:ByteBufAllocatorAllocate 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.- Specified by:
compositeBufferin interfaceByteBufAllocator
-
compositeHeapBuffer
public CompositeByteBuf compositeHeapBuffer()
Description copied from interface:ByteBufAllocatorAllocate a heapCompositeByteBuf.- Specified by:
compositeHeapBufferin interfaceByteBufAllocator
-
compositeHeapBuffer
public CompositeByteBuf compositeHeapBuffer(int maxNumComponents)
Description copied from interface:ByteBufAllocatorAllocate a heapCompositeByteBufwith the given maximum number of components that can be stored in it.- Specified by:
compositeHeapBufferin interfaceByteBufAllocator
-
compositeDirectBuffer
public CompositeByteBuf compositeDirectBuffer()
Description copied from interface:ByteBufAllocatorAllocate a directCompositeByteBuf.- Specified by:
compositeDirectBufferin interfaceByteBufAllocator
-
compositeDirectBuffer
public CompositeByteBuf compositeDirectBuffer(int maxNumComponents)
Description copied from interface:ByteBufAllocatorAllocate a directCompositeByteBufwith the given maximum number of components that can be stored in it.- Specified by:
compositeDirectBufferin interfaceByteBufAllocator
-
isDirectBufferPooled
public boolean isDirectBufferPooled()
Description copied from interface:ByteBufAllocatorReturnstrueif directByteBuf's are pooled- Specified by:
isDirectBufferPooledin interfaceByteBufAllocator
-
calculateNewCapacity
public int calculateNewCapacity(int minNewCapacity, int maxCapacity)Description copied from interface:ByteBufAllocatorCalculate the new capacity of aByteBufthat is used when aByteBufneeds to expand by theminNewCapacitywithmaxCapacityas upper-bound.- Specified by:
calculateNewCapacityin interfaceByteBufAllocator
-
-