JsonFactory instance.
| Modifier and Type | Class and Description |
|---|---|
| public static enum | JsonGenerator.
Enumeration that defines all togglable features for generators. |
| Modifier and Type | Field and Description |
|---|---|
| protected PrettyPrinter | _cfgPrettyPrinter
Object that handles pretty-printing (usually additional white space to make results more human-readable) during output. |
| protected static final JacksonFeatureSet | DEFAULT_BINARY_WRITE_CAPABILITIES
Default set of |
| protected static final JacksonFeatureSet | DEFAULT_TEXTUAL_WRITE_CAPABILITIES
Default set of |
| protected static final JacksonFeatureSet | DEFAULT_WRITE_CAPABILITIES
Default set of |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected StreamWriteException | |
| protected StreamWriteException | |
| protected StreamWriteException | |
| protected StreamWriteException | |
| protected void | |
| protected void | _copyCurrentFloatValue(JsonParser
Parser that points to the value to copy p)Method for copying current |
| protected void | _copyCurrentFloatValueExact(JsonParser
Parser that points to the value to copy p)Method for copying current |
| protected void | _copyCurrentIntValue(JsonParser
Parser that points to the value to copy p)Method for copying current |
| protected void | _copyCurrentStringValue(JsonParser
Parser that points to the value to copy p)Method for copying current |
| protected void | _reportError(String
Exception message to use msg)Helper method used for constructing and throwing
|
| protected void | |
| protected void | |
| protected final void | |
| protected final void | |
| protected void | _writeSimpleObject(Object
Value to write value)Helper method to try to call appropriate write method for given untyped Object. |
| public void | assignCurrentValue(Object
Current value to assign for the current context of this generator v)Helper method, usually equivalent to:
|
| public boolean | Returns: True if this generator is allowed to only write values
of some Object fields and omit the rest; false if notIntrospection method to call to check whether it is ok to omit writing of Object fields or not. |
| public boolean | Returns: True if this generator can use given schema; false if notSchema to check schema)Method that can be used to verify that given schema can be used with
this generator (using |
| public boolean | Returns: True if this generator is capable of writing "raw" Binary
Content
(this is typically determined by capabilities of the underlying format);
false if notIntrospection method that may be called to see if the underlying data format supports "native" binary data; that is, an efficient output of binary content without encoding. |
| public boolean | Returns: True if this generator is capable of writing "formatted"
numbers (and if so, need to be passed using
writeNumber(String), that is, passed as String);
false if notIntrospection method to call to check whether it is possible
to write numbers using |
| public boolean | Returns: True if this generator is capable of writing "native" Object Ids
(which is typically determined by capabilities of the underlying format),
false if notIntrospection method that may be called to see if the underlying data format supports some kind of Object Ids natively (many do not; for example, JSON doesn't). |
| public boolean | Returns: True if this generator is capable of writing "native" Type Ids
(which is typically determined by capabilities of the underlying format),
false if notIntrospection method that may be called to see if the underlying data format supports some kind of Type Ids natively (many do not; for example, JSON doesn't). |
| public abstract void | close()
Redeclares java. Method called to close this generator, so that no more content can be written. |
| public final JsonGenerator | Returns: This generator, to allow call chainingFeature to enable or disable f,Whether to enable ( state)true) or disable (false) featureMethod for enabling or disabling specified feature:
check |
| public void | copyCurrentEvent(JsonParser
Parser that points to event (token) to copy p)Method for copying contents of the current event that the given parser instance points to. |
| public void | copyCurrentEventExact(JsonParser
Parser that points to event (token) to copy p)Same as |
| public void | copyCurrentStructure(JsonParser
Parser that points to the value to copy p)Method for copying contents of the current event and following events that it encloses the given parser instance points to. |
| public Object | Returns: "Current value" associated with the current context (state) of this generatorHelper method, usually equivalent to:
Note that "current value" is NOT populated (or used) by Streaming parser or generators; it is only used by higher-level data-binding functionality. |
| public abstract JsonGenerator | Returns: This generator, to allow call chainingFeature to disable fMethod for disabling specified feature
(check |
| public abstract JsonGenerator | Returns: This generator, to allow call chainingFeature to enable fMethod for enabling specified generator feature:
check |
| public abstract void | flush()
Redeclares java. Method called to flush any buffered content to the underlying target (output stream, writer), and to flush the target itself as well. |
| public CharacterEscapes | getCharacterEscapes()
Method for accessing custom escapes factory uses for |
| public abstract ObjectCodec | Returns: Codec assigned to this generator, if any;null if noneMethod for accessing the object used for writing Java
object as JSON content
(using method |
| public Object | Returns: Location of the last processed input unit (byte or character)
Deprecated
Since 2.17 use
currentValue() instead
Alias for |
| public abstract int | Returns: Bit mask that defines current states of all standardJsonGenerator.s.Bulk access method for getting state of all standard (non-dataformat-specific)
|
| public int | Returns: Bit mask that defines current states of all standardFormatFeatures.Bulk access method for getting state of all |
| public int | Returns: Currently active limitation for highest non-escaped character, if defined; or 0 to indicate no additional escaping is performed.Accessor method for testing what is the highest unescaped character configured for this generator. |
| public int | Returns: Amount of content buffered in internal units, if amount known and accessible; -1 if not accessible.Method for verifying amount of content that is buffered by generator but not yet flushed to the underlying target (stream, writer), in units (byte, char) that the generator implementation uses for buffering; or -1 if this information is not available. |
| public abstract JsonStreamContext | Returns: Stream output context (JsonStreamContext) associated with this generatorAccessor for context object that provides information about low-level logical position withing output token stream. |
| public Object | Returns: Output target this generator was configured withMethod that can be used to get access to object that is used
as target for generated output; this is usually either
|
| public PrettyPrinter | getPrettyPrinter()
Accessor for checking whether this generator has a configured
|
| public FormatSchema | Returns: Schema in use by this generator, if any;null if noneMethod for accessing Schema that this generator uses, if any; |
| public JacksonFeatureSet | Returns: Set of write capabilities for content written using this generatorAccessor for getting metadata on capabilities of this generator, based on underlying data format being read (directly or indirectly). |
| public abstract boolean | Returns: True if this generator instance has been closedMethod that can be called to determine whether this generator is closed or not. |
| public abstract boolean | Returns: True if specified feature is enabled; false if notFeature to check fMethod for checking whether given feature is enabled. |
| public boolean | Returns: True if specified feature is enabled; false if notFeature to check f)Method for checking whether given feature is enabled. |
| public JsonGenerator | Returns: This generator, to allow call chainingBit mask of set/clear state for features to change values, int Bit mask of features to change mask)Bulk set method for (re)setting states of |
| public JsonGenerator | Returns: This generator, to allow call chainingBit mask of set/clear state for features to change values, int Bit mask of features to change mask)Bulk set method for (re)setting states of features specified by |
| public JsonGenerator | Returns: This generator, to allow call chainingCharacterEscapes to configure this generator to use, if any; null if noneMethod for defining custom escapes factory uses for |
| public abstract JsonGenerator | Returns: This generator, to allow call chainingCodec to assign, if any; oc)null if noneMethod that can be called to set or reset the object to
use for writing Java objects as JsonContent
(using method |
| public void | setCurrentValue(Object
Current value to assign for the current context of this generator v)
Deprecated
Since 2.17 use
currentValue() instead
Alias for |
| public abstract JsonGenerator | Returns: This generator, to allow call chainingBitmask that defines which values)Features are enabled
and which disabled
Deprecated
Since 2.7, use
overrideStdFeatures(int, int) instead -- remove from 2.9
Bulk set method for (re)setting states of all standard |
| public JsonGenerator | Returns: This generator, to allow call chainingEither -1 to indicate that no additional escaping
is to be done; or highest code point not to escape (meaning higher
ones will be), if positive value. charCode)Method that can be called to request that generator escapes all character codes above specified code point (if positive value); or, to not escape any characters except for ones that must be escaped for the data format (if -1). |
| public JsonGenerator | Returns: This generator, to allow call chainingPrettyPrinter to assign, if any; null if noneMethod for setting a custom pretty printer, which is usually used to add indentation for improved human readability. |
| public JsonGenerator | Returns: This generator, to allow call chainingSeparator to use, if any; null means that no separator is
automatically added sep)Method that allows overriding String used for separating root-level JSON values (default is single space character)
Default implementation throws |
| public void | setSchema(FormatSchema
Schema to use schema)Method to call to make this generator use specified schema. |
| public StreamWriteConstraints | Returns: StreamWriteConstraints used by this generatorGet the constraints to apply when performing streaming writes. |
| public abstract JsonGenerator | Returns: This generator, to allow call chainingConvenience method for enabling pretty-printing using
the default pretty printer
( |
| public abstract Version | Returns: Version of this generator (derived from version declared forjackson-core jar that contains the classRedeclares com. Accessor for finding out version of the bundle that provided this generator instance. |
| public void | writeArray(int[]
Array that contains values to write array, int Offset of the first element to write, within array offset, int Number of elements in array to write, from `offset` to `offset + len - 1` length)Value write method that can be called to write a single
array (sequence of |
| public void | writeArray(long[]
Array that contains values to write array, int Offset of the first element to write, within array offset, int Number of elements in array to write, from `offset` to `offset + len - 1` length)Value write method that can be called to write a single
array (sequence of |
| public void | writeArray(double[]
Array that contains values to write array, int Offset of the first element to write, within array offset, int Number of elements in array to write, from `offset` to `offset + len - 1` length)Value write method that can be called to write a single
array (sequence of |
| public void | writeArray(String[]
Array that contains values to write array, int Offset of the first element to write, within array offset, int Number of elements in array to write, from `offset` to `offset + len - 1` length)Value write method that can be called to write a single
array (sequence of |
| public void | writeArrayFieldStart(String
Name of the field to write fieldName)Convenience method for outputting a field entry ("member") (that will contain a JSON Array value), and the START_ARRAY marker. |
| public abstract 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. bv, 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)Method that will output given chunk of binary data as base64 encoded, as a complete String value (surrounded by double quotes). |
| public void | writeBinary(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)Similar to |
| public void | writeBinary(byte[]
Buffer that contains binary data to write data)Similar to |
| public int | Returns: Number of bytes actually writtenInputStream 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. 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 dataLength)Similar to |
| public abstract int | Returns: Number of bytes read fromdata and written as binary payloadBase64 variant to use bv, 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.Method similar to |
| public void | writeBinaryField(String
Name of the field to write fieldName, byte[] Binary data for the field to write data)Convenience method for outputting a field entry ("member") that contains specified data in base64-encoded form. |
| public abstract void | writeBoolean(boolean
Boolean value to write state)Method for outputting literal JSON boolean value (one of Strings 'true' and 'false'). |
| public void | writeBooleanField(String
Name of the field to write fieldName, boolean Boolean value of the field to write value)Convenience method for outputting a field entry ("member") that has a boolean value. |
| public void | writeEmbeddedObject(Object
Native format-specific value to write object)Method that can be called on backends that support passing opaque native values that some data formats support; not used with JSON backend, more common with binary formats. |
| public abstract void | writeEndArray()
Method for writing closing marker of a JSON Array value (character ']'; plus possible white space decoration if pretty-printing is enabled). |
| public abstract void | writeEndObject()
Method for writing closing marker of an Object value (character '}'; plus possible white space decoration if pretty-printing is enabled). |
| public void | writeFieldId(long
Field id to write id)Alternative to |
| public abstract void | writeFieldName(String
Field name to write name)Method for writing a field name (JSON String surrounded by double quotes: syntactically identical to a JSON String value), possibly decorated by white space if pretty-printing is enabled. |
| public abstract void | writeFieldName(SerializableString
Field name to write name)Method similar to |
| public abstract void | |
| public void | writeNullField(String
Name of the field to write fieldName)Convenience method for outputting a field entry ("member") that has JSON literal value null. |
| public void | |
| public abstract void | |
| public abstract void | |
| public abstract void | |
| public abstract void | |
| public abstract void | |
| public abstract void | |
| public abstract void | writeNumber(String
Textual (possibly formatted) number representation to write encodedValue)Write method that can be used for custom numeric types that can not be (easily?) converted to "standard" Java number types. |
| public void | writeNumber(char[]
Buffer that contains the textual number representation to write encodedValueBuffer, int Offset of the first character of value to write offset, int Length of the value (in characters) to write len)Overloaded version of |
| public void | writeNumberField(String
Name of the field to write fieldName, short Numeric value of the field to write value)Convenience method for outputting a field entry ("member") that has the specified numeric value. |
| public void | writeNumberField(String
Name of the field to write fieldName, int Numeric value of the field to write value)Convenience method for outputting a field entry ("member") that has the specified numeric value. |
| public void | writeNumberField(String
Name of the field to write fieldName, long Numeric value of the field to write value)Convenience method for outputting a field entry ("member") that has the specified numeric value. |
| public void | writeNumberField(String
Name of the field to write fieldName, BigInteger Numeric value of the field to write value)Convenience method for outputting a field entry ("member") that has the specified numeric value. |
| public void | writeNumberField(String
Name of the field to write fieldName, float Numeric value of the field to write value)Convenience method for outputting a field entry ("member") that has the specified numeric value. |
| public void | writeNumberField(String
Name of the field to write fieldName, double Numeric value of the field to write value)Convenience method for outputting a field entry ("member") that has the specified numeric value. |
| public void | writeNumberField(String
Name of the field to write fieldName, BigDecimal Numeric value of the field to write value)Convenience method for outputting a field entry ("member") that has the specified numeric value. |
| public abstract void | |
| public void | writeObjectField(String
Name of the field to write fieldName, Object POJO value of the field to write pojo)Older alias for |
| public void | writeObjectFieldStart(String
Name of the field to write fieldName)Convenience method for outputting a field entry ("member") (that will contain an Object value), and the START_OBJECT marker. |
| public void | writeObjectId(Object
Native Object Id to write id)Method that can be called to output so-called native Object Id.
Note that it may only be called after ensuring this is legal
(with |
| public void | writeObjectRef(Object
Referenced value, for which Object Id is expected to be written referenced)Method that can be called to output references to native Object Ids. |
| public void | writeOmittedField(String
Name of the field omitted fieldName)Method called to indicate that a property in this position was skipped. |
| public void | |
| public void | writePOJOField(String
Name of the field to write fieldName, Object POJO value of the field to write pojo)Convenience method for outputting a field entry ("member") that has contents of specific Java object as its value. |
| public abstract void | |
| public abstract 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 outputMethod that will force generator to copy input text verbatim with no modifications (including that no escaping is done and no separators are added even if context [array, object] would otherwise require such). |
| public abstract 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 outputMethod that will force generator to copy input text verbatim with no modifications (including that no escaping is done and no separators are added even if context [array, object] would otherwise require such). |
| public abstract void | writeRaw(char
Character to included in output c)Method that will force generator to copy input text verbatim with no modifications (including that no escaping is done and no separators are added even if context [array, object] would otherwise require such). |
| public void | writeRaw(SerializableString
Pre-encoded textual contents to included in output raw)Method that will force generator to copy input text verbatim with no modifications (including that no escaping is done and no separators are added even if context [array, object] would otherwise require such). |
| public abstract void | writeRawUTF8String(byte[]
Buffer that contains String value to write buffer, int Offset in offset, int buffer of the first byte of String value to writeLength of the String value (in characters) to write len)Method similar to |
| public abstract void | writeRawValue(String
Textual contents to included in output text)Method that will force generator to copy input text verbatim without any modifications, but assuming it must constitute a single legal JSON value (number, string, boolean, null, Array or List). |
| public abstract void | |
| public abstract void | |
| public void | writeRawValue(SerializableString
Pre-encoded textual contents to included in output raw)Method similar to |
| public abstract void | writeStartArray()
Method for writing starting marker of a Array value (for JSON this is character '['; plus possible white space decoration if pretty-printing is enabled). |
| public void | writeStartArray(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)
Deprecated
Since 2.12 Use
writeStartArray(Object, int) instead
Method for writing start marker of an Array value, similar
to |
| public void | writeStartArray(Object
"Current value" to assign for the Array context being created forValue)Method for writing start marker of an Array value, similar
to |
| 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)Method for writing start marker of an Array value, similar
to |
| public abstract void | writeStartObject()
Method for writing starting marker of an Object value (character '{'; plus possible white space decoration if pretty-printing is enabled). |
| public void | writeStartObject(Object
"Current value" to assign for the Object context being created forValue)Method for writing starting marker of an Object value to represent the given Java Object value. |
| 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)Method for writing starting marker of an Object value to represent the given Java Object value. |
| public abstract void | |
| public void | writeString(Reader
Reader to use for reading Text value to write reader, int Maximum Length of Text value to read (in len)chars, non-negative)
if known; -1 to indicate "read and write it all"Method for outputting a String value. |
| public abstract void | writeString(char[]
Buffer that contains String value to write buffer, int Offset in offset, int buffer of the first character of String value to writeLength of the String value (in characters) to write len)Method for outputting a String value. |
| public abstract void | writeString(SerializableString
Pre-encoded String value to write text)Method similar to |
| public void | writeStringField(String
Name of the field to write fieldName, String String value of the field to write value)Convenience method for outputting a field entry ("member") that has a String value. |
| public abstract void | |
| public void | writeTypeId(Object
Native Type Id to write id)Method that can be called to output so-called native Type Id.
Note that it may only be called after ensuring this is legal
(with |
| public WritableTypeId | writeTypePrefix(WritableTypeId
Full Type Id definition typeIdDef)Replacement method for |
| public WritableTypeId | Returns: ArgumenttypeIdDef, possibly modifiedValue returned by the earlier matching call to typeIdDef)writeTypePrefix(WritableTypeId)Method to call along with |
| public abstract void | writeUTF8String(byte[]
Buffer that contains String value to write buffer, int Offset in offset, int buffer of the first byte of String value to writeLength of the String value (in characters) to write len)Method similar to |