Class PrimitiveArrayBuilder<T>
- java.lang.Object
-
- com.fasterxml.jackson.databind.util.PrimitiveArrayBuilder<T>
-
- Direct Known Subclasses:
ArrayBuilders.BooleanBuilder
,ArrayBuilders.ByteBuilder
,ArrayBuilders.DoubleBuilder
,ArrayBuilders.FloatBuilder
,ArrayBuilders.IntBuilder
,ArrayBuilders.LongBuilder
,ArrayBuilders.ShortBuilder
public abstract class PrimitiveArrayBuilder<T> extends java.lang.Object
Base class for specialized primitive array builders.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class 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.
-
Field Summary
Fields Modifier and Type Field 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)
-
Constructor Summary
Constructors Modifier Constructor Description protected
PrimitiveArrayBuilder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method 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()
-
-
-
Field Detail
-
INITIAL_CHUNK_SIZE
static final int INITIAL_CHUNK_SIZE
Let's start with small chunks; typical usage is for small arrays anyway.- See Also:
- Constant Field Values
-
SMALL_CHUNK_SIZE
static final int SMALL_CHUNK_SIZE
Also: let's expand by doubling up until 64k chunks (which is 16k entries for 32-bit machines)- See Also:
- Constant Field Values
-
MAX_CHUNK_SIZE
static final int MAX_CHUNK_SIZE
Let's limit maximum size of chunks we use; helps avoid excessive allocation overhead for huge data sets. For now, let's limit to quarter million entries, 1 meg chunks for 32-bit machines.- See Also:
- Constant Field Values
-
_freeBuffer
protected T _freeBuffer
-
_bufferHead
protected PrimitiveArrayBuilder.Node<T> _bufferHead
-
_bufferTail
protected PrimitiveArrayBuilder.Node<T> _bufferTail
-
_bufferedEntryCount
protected int _bufferedEntryCount
Number of total buffered entries in this buffer, counting all instances within linked list formed by following_bufferHead
.
-
-
Method Detail
-
bufferedSize
public int bufferedSize()
-
resetAndStart
public T resetAndStart()
-
appendCompletedChunk
public final T appendCompletedChunk(T fullChunk, int fullChunkLength)
- Returns:
- Length of the next chunk to allocate
-
_constructArray
protected abstract T _constructArray(int len)
-
_reset
protected void _reset()
-
-