public abstract class BufferAllocator extends Object implements Closeable
| Modifier and Type | Field and Description |
|---|---|
static String |
STORE_DATA_FRAME_OUTPUT |
| Constructor and Description |
|---|
BufferAllocator() |
| Modifier and Type | Method and Description |
|---|---|
abstract ByteBuffer |
allocate(int size,
String owner)
Allocate a new ByteBuffer of given size.
|
abstract ByteBuffer |
allocateForStorage(int size)
Allocate a new ByteBuffer of given size for storage in a Region.
|
abstract Object |
baseObject(ByteBuffer buffer)
Get the base object of the ByteBuffer for raw reads/writes by Unsafe API.
|
abstract long |
baseOffset(ByteBuffer buffer)
Get the base offset of the ByteBuffer for raw reads/writes by Unsafe API.
|
void |
clearBuffer(ByteBuffer buffer,
int position,
int numBytes)
Clear the given portion of the buffer setting it with zeros.
|
abstract void |
clearPostAllocate(ByteBuffer buffer)
Clears the memory to be zeros immediately after allocation.
|
abstract void |
close()
Any cleanup required at system close.
|
abstract ByteBuffer |
expand(ByteBuffer buffer,
int required,
String owner)
Expand given ByteBuffer to new capacity.
|
static int |
expandedSize(int currentUsed,
int required) |
abstract ByteBuffer |
fromBytesToStorage(byte[] bytes,
int offset,
int length)
Return a ByteBuffer either copying from, or sharing the given heap bytes.
|
abstract boolean |
isDirect()
Indicates if this allocator will produce direct ByteBuffers.
|
abstract void |
release(ByteBuffer buffer)
For direct ByteBuffers the release method is preferred to eagerly release
the memory instead of depending on heap GC which can be delayed.
|
byte[] |
toBytes(ByteBuffer buffer)
Return the data as a heap byte array.
|
ByteBuffer |
transfer(ByteBuffer buffer,
String owner)
Return a ByteBuffer either sharing data of given ByteBuffer
if its type matches, or else copying from the given ByteBuffer.
|
public static final String STORE_DATA_FRAME_OUTPUT
public abstract ByteBuffer allocate(int size, String owner)
public abstract ByteBuffer allocateForStorage(int size)
public abstract void clearPostAllocate(ByteBuffer buffer)
public final void clearBuffer(ByteBuffer buffer, int position, int numBytes)
public abstract Object baseObject(ByteBuffer buffer)
public abstract long baseOffset(ByteBuffer buffer)
public abstract ByteBuffer expand(ByteBuffer buffer, int required, String owner)
public byte[] toBytes(ByteBuffer buffer)
public abstract ByteBuffer fromBytesToStorage(byte[] bytes, int offset, int length)
public ByteBuffer transfer(ByteBuffer buffer, String owner)
public abstract void release(ByteBuffer buffer)
public abstract boolean isDirect()
public abstract void close()
close in interface Closeableclose in interface AutoCloseablepublic static int expandedSize(int currentUsed,
int required)
Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.