java.lang.Object | ||
↳ | java.io.OutputStream | |
↳ | com.fasterxml.jackson.core.util.ByteArrayBuilder |
Helper class that is similar to java.io.ByteArrayOutputStream
in usage, but more geared to Jackson use cases internally.
Specific changes include segment storage (no need to have linear
backing buffer, can avoid reallocs, copying), as well API
not based on OutputStream
. In short, a very much
specialized builder object.
Since version 1.5, also implements OutputStream
to allow
efficient aggregation of output content as a byte array, similar
to how java.io.ByteArrayOutputStream works, but somewhat more
efficiently for many use cases.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Method that will complete "manual" output process, coalesce
content (if necessary) and return results as a contiguous buffer.
| |||||||||||
Method called when the current segment buffer is full; will
append to current contents, allocate a new segment buffer
and return it
| |||||||||||
Clean up method to call to release all buffers this object may be
using.
| |||||||||||
Method called when starting "manual" output: will clear out
current state and return the first segment buffer to fill
| |||||||||||
Method called when results are finalized and we can get the
full aggregated result buffer to return to the caller
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.io.OutputStream
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
java.io.Closeable
| |||||||||||
From interface
java.io.Flushable
| |||||||||||
From interface
java.lang.AutoCloseable
|
Method that will complete "manual" output process, coalesce content (if necessary) and return results as a contiguous buffer.
lastBlockLength | Amount of content in the current segment buffer. |
---|
Method called when the current segment buffer is full; will append to current contents, allocate a new segment buffer and return it
Clean up method to call to release all buffers this object may be using. After calling the method, no other accessors can be used (and attempt to do so may result in an exception)
Method called when starting "manual" output: will clear out current state and return the first segment buffer to fill
Method called when results are finalized and we can get the full aggregated result buffer to return to the caller