public final class ByteBlockPool extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ByteBlockPool.Allocator
Abstract class for allocating and freeing byte
blocks.
|
static class |
ByteBlockPool.DirectAllocator
A simple
ByteBlockPool.Allocator that never recycles. |
static class |
ByteBlockPool.DirectTrackingAllocator
A simple
ByteBlockPool.Allocator that never recycles, but
tracks how much total RAM is in use. |
Modifier and Type | Field and Description |
---|---|
byte[] |
buffer |
byte[][] |
buffers |
static int |
BYTE_BLOCK_MASK |
static int |
BYTE_BLOCK_SHIFT |
static int |
BYTE_BLOCK_SIZE |
int |
byteOffset |
int |
byteUpto |
static int |
FIRST_LEVEL_SIZE |
static int[] |
levelSizeArray |
static int[] |
nextLevelArray |
Constructor and Description |
---|
ByteBlockPool(ByteBlockPool.Allocator allocator) |
Modifier and Type | Method and Description |
---|---|
int |
allocSlice(byte[] slice,
int upto) |
void |
copy(BytesRef bytes)
|
BytesRef |
copyFrom(BytesRef bytes) |
void |
dropBuffersAndReset() |
int |
newSlice(int size) |
void |
nextBuffer() |
void |
reset() |
BytesRef |
setBytesRef(BytesRef term,
int textStart) |
void |
writePool(DataOutput out)
Writes the pools content to the given
DataOutput |
public static final int BYTE_BLOCK_SHIFT
public static final int BYTE_BLOCK_SIZE
public static final int BYTE_BLOCK_MASK
public byte[][] buffers
public int byteUpto
public byte[] buffer
public int byteOffset
public static final int[] nextLevelArray
public static final int[] levelSizeArray
public static final int FIRST_LEVEL_SIZE
public ByteBlockPool(ByteBlockPool.Allocator allocator)
public void dropBuffersAndReset()
public void reset()
public void nextBuffer()
public int newSlice(int size)
public int allocSlice(byte[] slice, int upto)
public final void copy(BytesRef bytes)
public final void writePool(DataOutput out) throws IOException
DataOutput
IOException