ObjectBuffer
Date: 2016-12-04

com.fasterxml.jackson.databind.util

## Class ObjectBuffer

- java.lang.Object
- - com.fasterxml.jackson.databind.util.ObjectBuffer

-     public final class ObjectBuffer
      extends java.lang.Object

  Helper class to use for constructing Object arrays by appending entries to create arrays of various lengths (length that is not known a priori).

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ObjectBuffer()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `_copyTo(java.lang.Object resultArray, int totalSize, java.lang.Object[] lastChunk, int lastChunkEntries)`
    `protected void` | `_reset()`
    `java.lang.Object[]` | `appendCompletedChunk(java.lang.Object[] fullChunk)` Method called to add a full Object array as a chunk buffered within this buffer, and to obtain a new array to fill.
    `int` | `bufferedSize()` Method that can be used to check how many Objects have been buffered within this buffer.
    `java.lang.Object[]` | `completeAndClearBuffer(java.lang.Object[] lastChunk, int lastChunkEntries)` Method called to indicate that the buffering process is now complete; and to construct a combined exactly-sized result array.
    `<T> T[]` | `completeAndClearBuffer(java.lang.Object[] lastChunk, int lastChunkEntries, java.lang.Class<T> componentType)` Type-safe alternative to `completeAndClearBuffer(Object[], int)`, to allow for constructing explicitly typed result array.
    `void` | `completeAndClearBuffer(java.lang.Object[] lastChunk, int lastChunkEntries, java.util.List<java.lang.Object> resultList)`
    `int` | `initialCapacity()` Helper method that can be used to check how much free capacity will this instance start with.
    `java.lang.Object[]` | `resetAndStart()` Method called to start buffering process.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ObjectBuffer

          public ObjectBuffer()

  - ### Method Detail

    - #### resetAndStart

          public java.lang.Object[] resetAndStart()

      Method called to start buffering process. Will ensure that the buffer is empty, and then return an object array to start chunking content on

    - #### appendCompletedChunk

          public java.lang.Object[] appendCompletedChunk(java.lang.Object[] fullChunk)

      Method called to add a full Object array as a chunk buffered within this buffer, and to obtain a new array to fill. Caller is not to use the array it gives; but to use the returned array for continued buffering.
      Parameters:
        `fullChunk` - Completed chunk that the caller is requesting to append to this buffer. It is generally chunk that was returned by an earlier call to `resetAndStart()` or `appendCompletedChunk(java.lang.Object[])` (although this is not required or enforced)
      Returns:
        New chunk buffer for caller to fill

    - #### completeAndClearBuffer

          public java.lang.Object[] completeAndClearBuffer(java.lang.Object[] lastChunk,
                                                  int lastChunkEntries)

      Method called to indicate that the buffering process is now complete; and to construct a combined exactly-sized result array. Additionally the buffer itself will be reset to reduce memory retention.

      Resulting array will be of generic `Object[]` type: if a typed array is needed, use the method with additional type argument.

    - #### completeAndClearBuffer

          public <T> T[] completeAndClearBuffer(java.lang.Object[] lastChunk,
                                       int lastChunkEntries,
                                       java.lang.Class<T> componentType)

      Type-safe alternative to `completeAndClearBuffer(Object[], int)`, to allow for constructing explicitly typed result array.
      Parameters:
        `componentType` - Type of elements included in the buffer. Will be used for constructing the result array.

    - #### completeAndClearBuffer

          public void completeAndClearBuffer(java.lang.Object[] lastChunk,
                                    int lastChunkEntries,
                                    java.util.List<java.lang.Object> resultList)

    - #### initialCapacity

          public int initialCapacity()

      Helper method that can be used to check how much free capacity will this instance start with. Can be used to choose the best instance to reuse, based on size of reusable object chunk buffer holds reference to.

    - #### bufferedSize

          public int bufferedSize()

      Method that can be used to check how many Objects have been buffered within this buffer.

    - #### _reset

          protected void _reset()

    - #### _copyTo

          protected final void _copyTo(java.lang.Object resultArray,
                     int totalSize,
                     java.lang.Object[] lastChunk,
                     int lastChunkEntries)