|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.store.bytebuffer.PlainByteBufferAllocator
public class PlainByteBufferAllocator
A simple byte buffer allocator that does not caching. The direct flag allows to control if the byte buffer will be allocated off heap or not.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.lucene.store.bytebuffer.ByteBufferAllocator |
---|
ByteBufferAllocator.Cleaner, ByteBufferAllocator.Type |
Field Summary | |
---|---|
protected boolean |
direct
|
protected int |
largeBufferSizeInBytes
|
protected int |
smallBufferSizeInBytes
|
Constructor Summary | |
---|---|
PlainByteBufferAllocator(boolean direct,
int smallBufferSizeInBytes,
int largeBufferSizeInBytes)
Constructs a new plain byte buffer allocator that does no caching. |
Method Summary | |
---|---|
java.nio.ByteBuffer |
allocate(ByteBufferAllocator.Type type)
Allocate a byte buffer for the specific type. |
void |
close()
Close the allocator, releasing any cached buffers for example. |
void |
release(java.nio.ByteBuffer buffer)
Release the buffer. |
int |
sizeInBytes(ByteBufferAllocator.Type type)
The size (in bytes) that is allocated for the provided type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final boolean direct
protected final int smallBufferSizeInBytes
protected final int largeBufferSizeInBytes
Constructor Detail |
---|
public PlainByteBufferAllocator(boolean direct, int smallBufferSizeInBytes, int largeBufferSizeInBytes)
direct
- If set to true, will allocate direct buffers (off heap).smallBufferSizeInBytes
- The size (in bytes) of the small buffer allocation.largeBufferSizeInBytes
- The size (in bytes) of the large buffer allocation.Method Detail |
---|
public int sizeInBytes(ByteBufferAllocator.Type type)
ByteBufferAllocator
sizeInBytes
in interface ByteBufferAllocator
public java.nio.ByteBuffer allocate(ByteBufferAllocator.Type type) throws java.io.IOException
ByteBufferAllocator
allocate
in interface ByteBufferAllocator
java.io.IOException
public void release(java.nio.ByteBuffer buffer)
ByteBufferAllocator
release
in interface ByteBufferAllocator
public void close()
ByteBufferAllocator
close
in interface ByteBufferAllocator
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |