Top Description Inners Fields Constructors Methods
com.fasterxml.jackson.databind.util

public abstract Class PrimitiveArrayBuilder<T>

extends Object
Class Inheritance
Known Direct Subclasses
com.fasterxml.jackson.databind.util.ArrayBuilders.BooleanBuilder, com.fasterxml.jackson.databind.util.ArrayBuilders.ByteBuilder, com.fasterxml.jackson.databind.util.ArrayBuilders.ShortBuilder, com.fasterxml.jackson.databind.util.ArrayBuilders.IntBuilder, com.fasterxml.jackson.databind.util.ArrayBuilders.LongBuilder, com.fasterxml.jackson.databind.util.ArrayBuilders.FloatBuilder, com.fasterxml.jackson.databind.util.ArrayBuilders.DoubleBuilder

Base class for specialized primitive array builders.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv 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

Modifier and TypeField 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>
protected PrimitiveArrayBuilder.Node<T>
protected T
pack-priv static final int
INITIAL_CHUNK_SIZE

Let's start with small chunks; typical usage is for small arrays anyway.

pack-priv static final int
MAX_CHUNK_SIZE

Let's limit maximum size of chunks we use; helps avoid excessive allocation overhead for huge data sets.

pack-priv static final int
SMALL_CHUNK_SIZE

Also: let's expand by doubling up until 64k chunks (which is 16k entries for 32-bit machines)

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected abstract T
_constructArray(int len)

protected void
public final T

Returns:

Length of the next chunk to allocate
appendCompletedChunk
(T fullChunk, int fullChunkLength)

public int
public T
completeAndClearBuffer(T lastChunk, int lastChunkEntries)

public T
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_bufferedEntryCountback to summary
protected int _bufferedEntryCount

Number of total buffered entries in this buffer, counting all instances within linked list formed by following _bufferHead.

_bufferHeadback to summary
protected PrimitiveArrayBuilder.Node<T> _bufferHead
_bufferTailback to summary
protected PrimitiveArrayBuilder.Node<T> _bufferTail
_freeBufferback to summary
protected T _freeBuffer
INITIAL_CHUNK_SIZEback to summary
pack-priv static final int INITIAL_CHUNK_SIZE

Let's start with small chunks; typical usage is for small arrays anyway.

MAX_CHUNK_SIZEback to summary
pack-priv 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.

SMALL_CHUNK_SIZEback to summary
pack-priv static final int SMALL_CHUNK_SIZE

Also: let's expand by doubling up until 64k chunks (which is 16k entries for 32-bit machines)

Constructor Detail

PrimitiveArrayBuilderback to summary
protected PrimitiveArrayBuilder()

Method Detail

_constructArrayback to summary
protected abstract T _constructArray(int len)
_resetback to summary
protected void _reset()
appendCompletedChunkback to summary
public final T appendCompletedChunk(T fullChunk, int fullChunkLength)
Returns:T

Length of the next chunk to allocate

bufferedSizeback to summary
public int bufferedSize()
completeAndClearBufferback to summary
public T completeAndClearBuffer(T lastChunk, int lastChunkEntries)
resetAndStartback to summary
public T resetAndStart()
com.fasterxml.jackson.databind.util back to summary

pack-priv final Class PrimitiveArrayBuilder.Node<T>

extends Object
Class Inheritance
  • java.lang.Object
  • com.fasterxml.jackson.databind.util.PrimitiveArrayBuilder.Node

For actual buffering beyond the current buffer, we can actually use shared class which only deals with opaque "untyped" chunks. This works because java.lang.System#arraycopy does not take type; hence we can implement some aspects of primitive data handling in generic fashion.

Field Summary

Modifier and TypeField and Description
pack-priv final T
_data

Data stored in this node.

pack-priv final int
_dataLength

Number entries in the (untyped) array.

pack-priv PrimitiveArrayBuilder.Node<T>

Constructor Summary

AccessConstructor and Description
public
Node(T data, int dataLen)

Method Summary

Modifier and TypeMethod and Description
public int
copyData(T dst, int ptr)

public T
public void
public PrimitiveArrayBuilder.Node<T>
next()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_databack to summary
pack-priv final T _data

Data stored in this node.

_dataLengthback to summary
pack-priv final int _dataLength

Number entries in the (untyped) array. Offset is assumed to be 0.

_nextback to summary
pack-priv PrimitiveArrayBuilder.Node<T> _next

Constructor Detail

Nodeback to summary
public Node(T data, int dataLen)

Method Detail

copyDataback to summary
public int copyData(T dst, int ptr)
getDataback to summary
public T getData()
linkNextback to summary
public void linkNext(PrimitiveArrayBuilder.Node<T> next)
nextback to summary
public PrimitiveArrayBuilder.Node<T> next()