Constructor and Description |
---|
BufferAllocator()
Create a
BufferAllocator of size=256, direct=false, and bufferSize=Buffer.SMALL_BUFFER_SIZE. |
BufferAllocator(int poolSize,
boolean direct,
int bufferSize)
Create a
BufferAllocator . |
Modifier and Type | Method and Description |
---|---|
Reference<Buffer> |
allocate()
Allocate an object from the internal pool.
|
List<Reference<Buffer>> |
allocateBatch(int size)
Allocate a batch of objects all at once.
|
void |
release(List<Reference<Buffer>> batch)
Efficiently release a batch of References all at once.
|
public BufferAllocator()
BufferAllocator
of size=256, direct=false, and bufferSize=Buffer.SMALL_BUFFER_SIZE.public BufferAllocator(int poolSize, boolean direct, int bufferSize)
BufferAllocator
.poolSize
- The number of Buffers to keep on hand.direct
- Whether or not to use direct buffers.bufferSize
- The size of the buffers.public Reference<Buffer> allocate()
Allocator
public List<Reference<Buffer>> allocateBatch(int size)
Allocator
allocateBatch
in interface Allocator<Buffer>
size
- the number of objects to allocateList
of References
to the allocated objectsCopyright © 2017. All rights reserved.