JsonToken
sequences, needed for temporary buffering.
Space efficient for different sequence lengths (especially so for smaller
ones; but not significantly less efficient for larger), highly efficient
for linear iteration and appending. Implemented as segmented/chunked
linked list of tokens; only modifications are via appends.
| Modifier and Type | Class and Description |
|---|---|
| protected static class | |
| protected static class | TokenBuffer.Segment
Individual segment of TokenBuffer that can store up to 16 tokens (limited by 4 bits per token type marker requirement). |
| Modifier and Type | Field and Description |
|---|---|
| protected int | _appendAt
Offset within last segment, |
| protected boolean | |
| protected TokenBuffer. | _first
First segment, for contents this buffer has |
| protected boolean | _forceBigDecimal
Flag set during construction, if use of |
| protected int | _generatorFeatures
Bit flag composed of bits that indicate which
|
| protected boolean | _hasNativeId
Do we currently have a native type or object id buffered? |
| protected boolean | |
| protected boolean | |
| protected TokenBuffer. | _last
Last segment of this buffer, one that is used for appending more tokens |
| protected boolean | |
| protected ObjectCodec | _objectCodec
Object codec to use for stream-based object conversion through parser/generator interfaces. |
| protected Object | _objectId
If native object ids supported, this is the id for following value (or first token of one) to be written. |
| protected JsonStreamContext | _parentContext
Parse context from "parent" parser (one from which content to buffer is read, if specified). |
| protected StreamReadConstraints | |
| protected Object | _typeId
If native type ids supported, this is the id for following value (or first token of one) to be written. |
| protected JsonWriteContext | |
| protected static final int |
| Access | Constructor and Description |
|---|---|
| public | TokenBuffer(ObjectCodec
Object codec to use for stream-based object
conversion through parser/generator interfaces. If null,
such methods cannot be used. codec, boolean Whether resulting hasNativeIds)JsonParser (if created)
is considered to support native type and object ids
|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected final void | _appendEndMarker(JsonToken type)
Specialized method used for appending a structural end Object/Array marker |
| protected final void | _appendFieldName(Object value)
Specialized method used for appending a field name, appending either
|
| private final void | |
| protected final void | _appendStartMarker(JsonToken type)
Specialized method used for appending a structural start Object/Array marker |
| protected final void | _appendValue(JsonToken type)
Method used for appending token known to represent a "simple" scalar value where token is the only information |
| protected final void | _appendValue(JsonToken type, Object value)
Method used for appending token known to represent a scalar value where there is additional content (text, number) beyond type token |
| private final void | |
| protected void | |
| private void | |
| protected void | |
| public TokenBuffer | Returns: This bufferHelper method that will append contents of given buffer into this buffer. |
| public static TokenBuffer | asCopyOfValue(JsonParser p)
Deprecated
Since 2.13: use
Convenience method, equivalent to:
DeserializationContext#bufferAsCopyOfValue instead.
TokenBuffer b = new TokenBuffer(p); b.copyCurrentStructure(p); return b; |
| public JsonParser | Returns: Parser that can be used for reading contents stored in this bufferMethod used to create a |
| public JsonParser | Returns: Parser that can be used for reading contents stored in this bufferObject codec to use for stream-based object
conversion through parser/generator interfaces. If null,
such methods cannot be used. codec)Method used to create a |
| public JsonParser | |
| public JsonParser | asParser(JsonParser
Parser to use for accessing source information
like location, configured codec, streamReadConstraints src)
|
| public JsonParser | |
| public boolean | canWriteBinaryNatively()
Overrides com. byte[], yes.
|
| public boolean | canWriteObjectId()
Overrides com. |
| public boolean | canWriteTypeId()
Overrides com. |
| public void | close()
Implements abstract com. Implements java. |
| public void | copyCurrentEvent(JsonParser
Parser that points to event (token) to copy p)Overrides com. |
| public void | copyCurrentStructure(JsonParser
Parser that points to the value to copy p)Overrides com. |
| public TokenBuffer | |
| public JsonGenerator | disable(JsonGenerator.
Feature to disable fImplements abstract com. Feature for list of features)
|
| public JsonGenerator | enable(JsonGenerator.
Feature to enable fImplements abstract com. Feature for list of available features.
|
| public JsonToken | |
| public void | flush()
Implements abstract com. Implements java. |
| public TokenBuffer | |
| public ObjectCodec | getCodec()
Implements abstract com. writeObject).
|
| public int | getFeatureMask()
Implements abstract com. JsonGenerator.s.
|
| public final JsonWriteContext | getOutputContext()
Implements abstract com. |
| public JacksonFeatureSet | getWriteCapabilities()
Overrides com. |
| public boolean | isClosed()
Implements abstract com. |
| public boolean | Returns: True if this buffer instance has no tokensAccessor for checking whether this buffer has one or more tokens or not. |
| public boolean | isEnabled(JsonGenerator.
Feature to check fImplements abstract com. |
| public TokenBuffer | overrideParentContext(JsonStreamContext ctxt)
Method that allows explicitly specifying parent parse context to associate with contents of this buffer. |
| public JsonGenerator | overrideStdFeatures(int
Bit mask of set/clear state for features to change values, int Bit mask of features to change mask)Overrides com. mask.
|
| public void | serialize(JsonGenerator gen)
Helper method that will write all contents of this buffer
using given |
| public JsonGenerator | setCodec(ObjectCodec
Codec to assign, if any; oc)null if noneImplements abstract com. writeObject).
|
| public JsonGenerator | setFeatureMask(int
Bitmask that defines which mask)Features are enabled
and which disabledImplements abstract com.
Deprecated
Bulk set method for (re)setting states of all standard Features
|
| public String | |
| public JsonGenerator | useDefaultPrettyPrinter()
Implements abstract com. com.).
|
| public Version | version()
Implements abstract com. Implements com. |
| public void | writeBinary(Base64Variant
Base64 variant to use: defines details such as
whether padding is used (and if so, using which character);
what is the maximum line length before adding linefeed,
and also the underlying alphabet to use. b64variant, byte[] Buffer that contains binary data to write data, int Offset in offset, int data of the first byte of data to writeLength of data to write len)Implements abstract com. |
| public int | writeBinary(Base64Variant
Base64 variant to use b64variant, InputStream InputStream to use for reading binary data to write.
Will not be closed after successful write operation data, int (optional) number of bytes that will be available;
or -1 to be indicate it is not known.
If a positive length is given, dataLength)data MUST provide at least
that many bytes: if not, an exception will be thrown.
Note that implementations
need not support cases where length is not known in advance; this
depends on underlying data format: JSON output does NOT require length,
other formats may.Implements abstract com. |
| public void | writeBoolean(boolean
Boolean value to write state)Implements abstract com. |
| public void | writeEmbeddedObject(Object
Native format-specific value to write object)Overrides com. |
| public final void | writeEndArray()
Implements abstract com. |
| public final void | writeEndObject()
Implements abstract com. |
| public final void | writeFieldName(String
Field name to write name)Implements abstract com. |
| public void | writeFieldName(SerializableString
Field name to write name)Implements abstract com. writeFieldName(String), main difference
being that it may perform better as some of processing (such as
quoting of certain characters, or encoding into external encoding
if supported by generator) can be done just once and reused for
later calls.
|
| private void | |
| private void | |
| public void | writeNull()
Implements abstract com. |
| public void | writeNumber(short
Number value to write i)Overrides com. |
| public void | writeNumber(int
Number value to write i)Implements abstract com. |
| public void | writeNumber(long
Number value to write l)Implements abstract com. |
| public void | writeNumber(double
Number value to write d)Implements abstract com. |
| public void | writeNumber(float
Number value to write f)Implements abstract com. |
| public void | writeNumber(BigDecimal
Number value to write dec)Implements abstract com. |
| public void | writeNumber(BigInteger
Number value to write v)Implements abstract com. |
| public void | writeNumber(String
Textual (possibly format) number representation to write encodedValue)Implements abstract com. |
| public void | writeObject(Object
Java value (usually POJO) to write value)Implements abstract com. writePOJO(Object)
|
| public void | writeObjectId(Object
Native Object Id to write id)Overrides com. canWriteObjectId()), as not all data formats
have native type id support; and some may only allow them in
certain positions or locations.
|
| public void | writeRaw(String
Textual contents to include as-is in output. text)Implements abstract com. |
| public void | writeRaw(String
String that has contents to include as-is in output text, int Offset within offset, int text of the first character to outputLength of content (from len)text, starting at offset offset) to outputImplements abstract com. |
| public void | writeRaw(SerializableString
Pre-encoded textual contents to included in output text)Overrides com. |
| public void | writeRaw(char[]
Buffer that has contents to include as-is in output text, int Offset within offset, int text of the first character to outputLength of content (from len)text, starting at offset offset) to outputImplements abstract com. |
| public void | writeRaw(char
Character to included in output c)Implements abstract com. |
| public void | writeRawUTF8String(byte[]
Buffer that contains String value to write text, int Offset in offset, int buffer of the first byte of String value to writeLength of the String value (in characters) to write length)Implements abstract com. writeString(String) but that takes as
its input a UTF-8 encoded String that is to be output as-is, without additional
escaping (type of which depends on data format; backslashes for JSON).
|
| public void | writeRawValue(String
Textual contents to included in output text)Implements abstract com. |
| public void | writeRawValue(String text, int offset, int len)
Implements abstract com. |
| public void | writeRawValue(char[] text, int offset, int len)
Implements abstract com. |
| public final void | writeStartArray()
Implements abstract com. |
| public void | writeStartArray(Object
"Current value" to assign for the Array context being created forValue)Overrides com. writeStartArray(),
but also specifying the "current value"
to assign to the new Array context being created.
|
| public void | writeStartArray(Object
"Current value" to assign for the Array context being created forValue, int Number of elements this Array will have: actual
number of values written (before matching call to
size)writeEndArray() MUST match; generator MAY verify
this is the case (and SHOULD if format itself encodes length)Overrides com. writeStartArray(), but also specifying the "current value"
to assign to the new Array context being created
as well as how many elements will be written for the array before calling
writeEndArray().
|
| public final void | writeStartObject()
Implements abstract com. |
| public void | writeStartObject(Object
"Current value" to assign for the Object context being created forValue)Overrides com. |
| public void | writeStartObject(Object
"Current value" to assign for the Object context being created forValue, int Number of key/value pairs this Object will have: actual
number of entries written (before matching call to
size)writeEndObject() MUST match; generator MAY verify
this is the case (and SHOULD if format itself encodes length)Overrides com. |
| public void | writeString(String
Text value to write text)Implements abstract com. |
| public void | writeString(char[]
Buffer that contains String value to write text, int Offset in offset, int buffer of the first character of String value to writeLength of the String value (in characters) to write len)Implements abstract com. |
| public void | writeString(SerializableString
Pre-encoded String value to write text)Implements abstract com. writeString(String), but that takes
SerializableString which can make this potentially
more efficient to call as generator may be able to reuse
quoted and/or encoded representation.
|
| public void | writeString(Reader
Reader to use for reading Text value to write reader, final int Maximum Length of Text value to read (in len)chars, non-negative)
if known; -1 to indicate "read and write it all"Overrides com. |
| public void | writeTree(TreeNode
TreeNode to writeImplements abstract com. |
| public void | writeTypeId(Object
Native Type Id to write id)Overrides com. canWriteTypeId()), as not all data formats
have native type id support; and some may only allow them in
certain positions or locations.
|
| public void | writeUTF8String(byte[]
Buffer that contains String value to write text, int Offset in offset, int buffer of the first byte of String value to writeLength of the String value (in characters) to write length)Implements abstract com. writeString(String) but that takes as its input
a UTF-8 encoded String which has not been escaped using whatever
escaping scheme data format requires (for JSON that is backslash-escaping
for control characters and double-quotes; for other formats something else).
|