public class BufferFactory extends Object
ByteBuffer with default size of
BUFFER_CAPACITY. The factory reduces frequent memory
allocation overheads and also helps reduce the garbage production rate.| Constructor and Description |
|---|
BufferFactory() |
| Modifier and Type | Method and Description |
|---|---|
static ByteBuffer |
getBuffer()
Get a buffer of size
BUFFER_CAPACITY. |
static ByteBuffer |
getBuffer(int size)
Get a custom sized
ByteBuffer from factory. |
public static ByteBuffer getBuffer()
BUFFER_CAPACITY. Currently
this method simply allocates the buffer of default size.ByteBuffer object from factory buffer poolpublic static ByteBuffer getBuffer(int size)
ByteBuffer from factory. Factory does not
recycle custom sized buffers.size - size of the bufferByteBuffer allocatedCopyright © 2019. All rights reserved.