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
Current head buffer
|
byte[][] |
buffers |
static int |
BYTE_BLOCK_MASK |
static int |
BYTE_BLOCK_SHIFT |
static int |
BYTE_BLOCK_SIZE |
int |
byteOffset
Current head offset
|
int |
byteUpto
Where we are in head buffer
|
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) |
BytesRef |
deref(BytesRef bytes)
Dereferences the byte block according to
BytesRef offset. |
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 BytesRef deref(BytesRef bytes)
BytesRef
offset. The offset
is interpreted as the absolute offset into the ByteBlockPool
.public final void copy(BytesRef bytes)
public final void writePool(DataOutput out) throws IOException
DataOutput
IOException
Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.