public abstract class PrimitiveArrayBuilder<T>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
PrimitiveArrayBuilder.Node<T>
For actual buffering beyond the current buffer, we can actually
use shared class which only deals with opaque "untyped" chunks.
|
Modifier and Type | Field and Description |
---|---|
protected int |
_bufferedEntryCount
Number of total buffered entries in this buffer, counting all instances
within linked list formed by following
_bufferHead . |
protected PrimitiveArrayBuilder.Node<T> |
_bufferHead |
protected PrimitiveArrayBuilder.Node<T> |
_bufferTail |
protected T |
_freeBuffer |
(package private) static int |
INITIAL_CHUNK_SIZE
Let's start with small chunks; typical usage is for small arrays anyway.
|
(package private) static int |
MAX_CHUNK_SIZE
Let's limit maximum size of chunks we use; helps avoid excessive allocation
overhead for huge data sets.
|
(package private) static int |
SMALL_CHUNK_SIZE
Also: let's expand by doubling up until 64k chunks (which is 16k entries for
32-bit machines)
|
Modifier | Constructor and Description |
---|---|
protected |
PrimitiveArrayBuilder() |
Modifier and Type | Method and Description |
---|---|
protected abstract T |
_constructArray(int len) |
protected void |
_reset() |
T |
appendCompletedChunk(T fullChunk,
int fullChunkLength) |
int |
bufferedSize() |
T |
completeAndClearBuffer(T lastChunk,
int lastChunkEntries) |
T |
resetAndStart() |
static final int INITIAL_CHUNK_SIZE
static final int SMALL_CHUNK_SIZE
static final int MAX_CHUNK_SIZE
protected T _freeBuffer
protected PrimitiveArrayBuilder.Node<T> _bufferHead
protected PrimitiveArrayBuilder.Node<T> _bufferTail
protected int _bufferedEntryCount
_bufferHead
.public int bufferedSize()
public T resetAndStart()
public final T appendCompletedChunk(T fullChunk, int fullChunkLength)
protected abstract T _constructArray(int len)
protected void _reset()