Top Description Fields Constructors Methods
com.fasterxml.jackson.core.base

public abstract Class GeneratorBase

extends JsonGenerator
Class Inheritance
Known Direct Subclasses
com.fasterxml.jackson.core.json.JsonGeneratorImpl
Imports
java.io.IOException, .InputStream, java.math.BigDecimal, com.fasterxml.jackson.core.*, com.fasterxml.jackson.core.io.IOContext, .UTF8Writer, com.fasterxml.jackson.core.json.DupDetector, .JsonWriteContext, .PackageVersion, com.fasterxml.jackson.core.util.DefaultPrettyPrinter

This base class implements part of API that a JSON generator exposes to applications, adds shared internal methods that sub-classes can use and adds some abstract methods sub-classes must implement.

Field Summary

Modifier and TypeField and Description
protected boolean
_cfgNumbersAsStrings

Flag set to indicate that implicit conversion from number to JSON String is needed (as per com.fasterxml.jackson.core.json.JsonWriteFeature#WRITE_NUMBERS_AS_STRINGS).

protected boolean
_closed

Flag that indicates whether generator is closed or not.

protected int
_features

Bit flag composed of bits that indicate which com.fasterxml.jackson.core.JsonGenerator.Features are enabled.

protected final IOContext
protected ObjectCodec
protected JsonWriteContext
_writeContext

Object that keeps track of the current contextual state of the generator.

protected static final int
DERIVED_FEATURES_MASK

Set of feature masks related to features that need updates of other local configuration or state.

protected static final int
MAX_BIG_DECIMAL_SCALE

This value is the limit of scale allowed for serializing BigDecimal in "plain" (non-engineering) notation; intent is to prevent asymmetric attack whereupon simple eng-notation with big scale is used to generate huge "plain" serialization.

public static final int
public static final int
public static final int
public static final int
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
Inherited from com.fasterxml.jackson.core.JsonGenerator:
_cfgPrettyPrinterDEFAULT_BINARY_WRITE_CAPABILITIESDEFAULT_TEXTUAL_WRITE_CAPABILITIESDEFAULT_WRITE_CAPABILITIES

Constructor Summary

AccessConstructor and Description
protected
GeneratorBase(int features, ObjectCodec codec)
Deprecated

protected
GeneratorBase(int features, ObjectCodec codec, IOContext ioContext)

protected
GeneratorBase(int features, ObjectCodec codec, JsonWriteContext ctxt)
Deprecated

protected
GeneratorBase(int features, ObjectCodec codec, IOContext ioContext, JsonWriteContext jsonWriteContext)

Method Summary

Modifier and TypeMethod and Description
protected String

Returns:

String representation of value
_asString
(BigDecimal
BigDecimal value to convert to String
value
)

Helper method used to serialize a java.math.BigDecimal as a String, for serialization, taking into account configuration settings

protected void
_checkRangeBoundsForByteArray(byte[] data, int offset, int len)

protected void
_checkRangeBoundsForCharArray(char[] data, int offset, int len)

protected void
_checkRangeBoundsForString(String data, int offset, int len)

protected void
_checkStdFeatureChanges(int
Bitflag of standard features after they were changed
newFeatureFlags
,
int
Bitflag of standard features for which setting did change
changedFeatures
)

Helper method called to verify changes to standard features.

protected PrettyPrinter

Returns:

Instance of "default" pretty printer to use
_constructDefaultPrettyPrinter
()

Overridable factory method called to instantiate an appropriate PrettyPrinter for case of "just use the default one", when useDefaultPrettyPrinter() is called.

protected final int
_decodeSurrogate(int surr1, int surr2)

protected abstract void
_releaseBuffers()

Method called to release any buffers generator may be holding, once generator is being closed.

protected abstract void
_verifyValueWrite(String
Additional message used for generating exception message if value output is NOT legal in current generator output state.
typeMsg
)

Method called before trying to write a value (scalar or structured), to verify that this is legal in current output state, as well as to output separators if and as necessary.

public void
assignCurrentValue(Object
Current value to assign for the current context of this generator
v
)

Overrides com.fasterxml.jackson.core.JsonGenerator.assignCurrentValue.

Helper method, usually equivalent to: getOutputContext().setCurrentValue(v);

public void
close()

Implements abstract com.fasterxml.jackson.core.JsonGenerator.close.

Implements java.io.Closeable.close.

Method called to close this generator, so that no more content can be written.

public Object
currentValue()

Overrides com.fasterxml.jackson.core.JsonGenerator.currentValue.

Helper method, usually equivalent to: getOutputContext().getCurrentValue();

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 JsonGenerator
disable(JsonGenerator.Feature
Feature to disable
f
)

Implements abstract com.fasterxml.jackson.core.JsonGenerator.disable.

Method for disabling specified feature (check Feature for list of features)

public JsonGenerator
enable(JsonGenerator.Feature
Feature to enable
f
)

Implements abstract com.fasterxml.jackson.core.JsonGenerator.enable.

Method for enabling specified generator feature: check Feature for list of available features.

public abstract void
flush()

Redeclares java.io.Flushable.flush.

Implements abstract com.fasterxml.jackson.core.JsonGenerator.flush.

Method called to flush any buffered content to the underlying target (output stream, writer), and to flush the target itself as well.

public ObjectCodec
getCodec()

Implements abstract com.fasterxml.jackson.core.JsonGenerator.getCodec.

Method for accessing the object used for writing Java object as JSON content (using method writeObject).

public int
getFeatureMask()

Implements abstract com.fasterxml.jackson.core.JsonGenerator.getFeatureMask.

Bulk access method for getting state of all standard (non-dataformat-specific) JsonGenerator.Features.

public JsonStreamContext
getOutputContext()

Implements abstract com.fasterxml.jackson.core.JsonGenerator.getOutputContext.

Note

type was co-variant until Jackson 2.7; reverted back to base type in 2.8 to allow for overriding by subtypes that use custom context type.

public IOContext

Returns:

IOContext in use by this generator
ioContext
()

Accessor for use by jackson-core itself (tests in particular).

public boolean
isClosed()

Implements abstract com.fasterxml.jackson.core.JsonGenerator.isClosed.

Method that can be called to determine whether this generator is closed or not.

public final boolean
isEnabled(JsonGenerator.Feature
Feature to check
f
)

Implements abstract com.fasterxml.jackson.core.JsonGenerator.isEnabled.

Method for checking whether given feature is enabled.

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.fasterxml.jackson.core.JsonGenerator.overrideStdFeatures.

Bulk set method for (re)setting states of features specified by mask.

public JsonGenerator
setCodec(ObjectCodec
Codec to assign, if any; null if none
oc
)

Implements abstract com.fasterxml.jackson.core.JsonGenerator.setCodec.

Method that can be called to set or reset the object to use for writing Java objects as JsonContent (using method writeObject).

public JsonGenerator
setFeatureMask(int
Bitmask that defines which Features are enabled and which disabled
newMask
)

Implements abstract com.fasterxml.jackson.core.JsonGenerator.setFeatureMask.

Deprecated

Bulk set method for (re)setting states of all standard Features

public JsonGenerator
useDefaultPrettyPrinter()

Implements abstract com.fasterxml.jackson.core.JsonGenerator.useDefaultPrettyPrinter.

Convenience method for enabling pretty-printing using the default pretty printer (com.fasterxml.jackson.core.util.DefaultPrettyPrinter).

public Version

Returns:

Version number of the generator (version of the jar that contains generator implementation class)
version
()

Implements abstract com.fasterxml.jackson.core.JsonGenerator.version.

Implements com.fasterxml.jackson.core.Versioned.version.

Implemented with standard version number detection algorithm, typically using a simple generated class, with information extracted from Maven project file during build.

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, 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.
dataLength
)

Implements abstract com.fasterxml.jackson.core.JsonGenerator.writeBinary.

Method similar to writeBinary(Base64Variant, byte[], int, int), but where input is provided through a stream, allowing for incremental writes without holding the whole input in memory.

public void
writeFieldName(SerializableString
Field name to write
name
)

Implements abstract com.fasterxml.jackson.core.JsonGenerator.writeFieldName.

Method similar to 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.

public void
writeObject(Object
Java value (usually POJO) to write
value
)

Implements abstract com.fasterxml.jackson.core.JsonGenerator.writeObject.

Older alias for writePOJO(Object)

public void
writeRawValue(String
Textual contents to included in output
text
)

Implements abstract com.fasterxml.jackson.core.JsonGenerator.writeRawValue.

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 void
writeRawValue(String text, int offset, int len)

Implements abstract com.fasterxml.jackson.core.JsonGenerator.writeRawValue.

public void
writeRawValue(char[] text, int offset, int len)

Implements abstract com.fasterxml.jackson.core.JsonGenerator.writeRawValue.

public void
writeRawValue(SerializableString
Pre-encoded textual contents to included in output
text
)

Overrides com.fasterxml.jackson.core.JsonGenerator.writeRawValue.

Method similar to writeRawValue(String), but potentially more efficient as it may be able to use pre-encoded content (similar to writeRaw(SerializableString).

public void
writeStartObject(Object
"Current value" to assign for the Object context being created
forValue
)

Overrides com.fasterxml.jackson.core.JsonGenerator.writeStartObject.

Method for writing starting marker of an Object value to represent the given Java Object value.

public void
writeString(SerializableString
Pre-encoded String value to write
text
)

Implements abstract com.fasterxml.jackson.core.JsonGenerator.writeString.

Method similar to 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
writeTree(TreeNode
TreeNode to write
rootNode
)

Implements abstract com.fasterxml.jackson.core.JsonGenerator.writeTree.

Method for writing given JSON tree (expressed as a tree where given JsonNode is the root) using this generator.

Inherited from com.fasterxml.jackson.core.JsonGenerator:
_copyCurrentContents_copyCurrentFloatValue_copyCurrentFloatValueExact_copyCurrentIntValue_copyCurrentStringValue_reportError_reportUnsupportedOperation_throwInternal_verifyOffsets_writeSimpleObjectcanOmitFieldscanUseSchemacanWriteBinaryNativelycanWriteFormattedNumberscanWriteObjectIdcanWriteTypeIdconfigurecopyCurrentEventcopyCurrentEventExactcopyCurrentStructuregetCharacterEscapesgetCurrentValuegetFormatFeaturesgetHighestEscapedChargetOutputBufferedgetOutputTargetgetPrettyPrintergetSchemagetWriteCapabilitiesisEnabledoverrideFormatFeaturessetCharacterEscapessetCurrentValuesetHighestNonEscapedCharsetPrettyPrintersetRootValueSeparatorsetSchemastreamWriteConstraintswriteArraywriteArraywriteArraywriteArraywriteArrayFieldStartwriteBinarywriteBinarywriteBinarywriteBinarywriteBinaryFieldwriteBooleanwriteBooleanFieldwriteEmbeddedObjectwriteEndArraywriteEndObjectwriteFieldIdwriteFieldNamewriteNullwriteNullFieldwriteNumberwriteNumberwriteNumberwriteNumberwriteNumberwriteNumberwriteNumberwriteNumberwriteNumberwriteNumberFieldwriteNumberFieldwriteNumberFieldwriteNumberFieldwriteNumberFieldwriteNumberFieldwriteNumberFieldwriteObjectFieldwriteObjectFieldStartwriteObjectIdwriteObjectRefwriteOmittedFieldwritePOJOwritePOJOFieldwriteRawwriteRawwriteRawwriteRawwriteRawwriteRawUTF8StringwriteStartArraywriteStartArraywriteStartArraywriteStartArraywriteStartObjectwriteStartObjectwriteStringwriteStringwriteStringwriteStringFieldwriteTypeIdwriteTypePrefixwriteTypeSuffixwriteUTF8String

Field Detail

_cfgNumbersAsStringsback to summary
protected boolean _cfgNumbersAsStrings

Flag set to indicate that implicit conversion from number to JSON String is needed (as per com.fasterxml.jackson.core.json.JsonWriteFeature#WRITE_NUMBERS_AS_STRINGS).

_closedback to summary
protected boolean _closed

Flag that indicates whether generator is closed or not. Gets set when it is closed by an explicit call (close).

_featuresback to summary
protected int _features

Bit flag composed of bits that indicate which com.fasterxml.jackson.core.JsonGenerator.Features are enabled.

_ioContextback to summary
protected final IOContext _ioContext
_objectCodecback to summary
protected ObjectCodec _objectCodec
_writeContextback to summary
protected JsonWriteContext _writeContext

Object that keeps track of the current contextual state of the generator.

DERIVED_FEATURES_MASKback to summary
protected static final int DERIVED_FEATURES_MASK

Set of feature masks related to features that need updates of other local configuration or state.

Annotations
@SuppressWarnings:deprecation
Since
2.5
MAX_BIG_DECIMAL_SCALEback to summary
protected static final int MAX_BIG_DECIMAL_SCALE

This value is the limit of scale allowed for serializing BigDecimal in "plain" (non-engineering) notation; intent is to prevent asymmetric attack whereupon simple eng-notation with big scale is used to generate huge "plain" serialization. See [core#315] for details.

Since
2.7.7
SURR1_FIRSTback to summary
public static final int SURR1_FIRST
SURR1_LASTback to summary
public static final int SURR1_LAST
SURR2_FIRSTback to summary
public static final int SURR2_FIRST
SURR2_LASTback to summary
public static final int SURR2_LAST
WRITE_BINARYback to summary
protected static final String WRITE_BINARY
WRITE_BOOLEANback to summary
protected static final String WRITE_BOOLEAN
WRITE_NULLback to summary
protected static final String WRITE_NULL
WRITE_NUMBERback to summary
protected static final String WRITE_NUMBER
WRITE_RAWback to summary
protected static final String WRITE_RAW
WRITE_STRINGback to summary
protected static final String WRITE_STRING

Constructor Detail

GeneratorBaseback to summary
protected GeneratorBase(int features, ObjectCodec codec)

Deprecated

Annotations
@Deprecated
GeneratorBaseback to summary
protected GeneratorBase(int features, ObjectCodec codec, IOContext ioContext)
Annotations
@SuppressWarnings:deprecation
GeneratorBaseback to summary
protected GeneratorBase(int features, ObjectCodec codec, JsonWriteContext ctxt)

Deprecated

Annotations
@Deprecated
GeneratorBaseback to summary
protected GeneratorBase(int features, ObjectCodec codec, IOContext ioContext, JsonWriteContext jsonWriteContext)
Annotations
@SuppressWarnings:deprecation

Method Detail

_asStringback to summary
protected String _asString(BigDecimal value) throws IOException

Helper method used to serialize a java.math.BigDecimal as a String, for serialization, taking into account configuration settings

Parameters
value:BigDecimal

BigDecimal value to convert to String

Returns:String

String representation of value

Exceptions
IOException:
if there is a problem serializing value as String
Since
2.7.7
_checkRangeBoundsForByteArrayback to summary
protected void _checkRangeBoundsForByteArray(byte[] data, int offset, int len) throws IOException
_checkRangeBoundsForCharArrayback to summary
protected void _checkRangeBoundsForCharArray(char[] data, int offset, int len) throws IOException
_checkRangeBoundsForStringback to summary
protected void _checkRangeBoundsForString(String data, int offset, int len) throws IOException
_checkStdFeatureChangesback to summary
protected void _checkStdFeatureChanges(int newFeatureFlags, int changedFeatures)

Helper method called to verify changes to standard features.

Parameters
newFeatureFlags:int

Bitflag of standard features after they were changed

changedFeatures:int

Bitflag of standard features for which setting did change

Annotations
@SuppressWarnings:deprecation
Since
2.7
_constructDefaultPrettyPrinterback to summary
protected PrettyPrinter _constructDefaultPrettyPrinter()

Overridable factory method called to instantiate an appropriate PrettyPrinter for case of "just use the default one", when useDefaultPrettyPrinter() is called.

Returns:PrettyPrinter

Instance of "default" pretty printer to use

Since
2.6
_decodeSurrogateback to summary
protected final int _decodeSurrogate(int surr1, int surr2) throws IOException
_releaseBuffersback to summary
protected abstract void _releaseBuffers()

Method called to release any buffers generator may be holding, once generator is being closed.

_verifyValueWriteback to summary
protected abstract void _verifyValueWrite(String typeMsg) throws IOException

Method called before trying to write a value (scalar or structured), to verify that this is legal in current output state, as well as to output separators if and as necessary.

Parameters
typeMsg:String

Additional message used for generating exception message if value output is NOT legal in current generator output state.

Exceptions
IOException:
if there is either an underlying I/O problem or encoding issue at format layer
assignCurrentValueback to summary
public void assignCurrentValue(Object v)

Overrides com.fasterxml.jackson.core.JsonGenerator.assignCurrentValue.

Doc from com.fasterxml.jackson.core.JsonGenerator.assignCurrentValue.

Helper method, usually equivalent to: getOutputContext().setCurrentValue(v);

Parameters
v:Object

Current value to assign for the current context of this generator

Annotations
@Override
closeback to summary
public void close() throws IOException

Implements abstract com.fasterxml.jackson.core.JsonGenerator.close.

Implements java.io.Closeable.close.

Doc from com.fasterxml.jackson.core.JsonGenerator.close.

Method called to close this generator, so that no more content can be written.

Whether the underlying target (stream, writer) gets closed depends on whether this generator either manages the target (i.e. is the only one with access to the target -- case if caller passes a reference to the resource such as File, but not stream); or has feature Feature#AUTO_CLOSE_TARGET enabled. If either of above is true, the target is also closed. Otherwise (not managing, feature not enabled), target is not closed.

Annotations
@Override
Exceptions
IOException:
if there is either an underlying I/O problem
currentValueback to summary
public Object currentValue()

Overrides com.fasterxml.jackson.core.JsonGenerator.currentValue.

Doc from com.fasterxml.jackson.core.JsonGenerator.currentValue.

Helper method, usually equivalent to: getOutputContext().getCurrentValue();

Note that "current value" is NOT populated (or used) by Streaming parser or generators; it is only used by higher-level data-binding functionality. The reason it is included here is that it can be stored and accessed hierarchically, and gets passed through data-binding.

Returns:Object

"Current value" associated with the current context (state) of this generator

Annotations
@Override
disableback to summary
public JsonGenerator disable(JsonGenerator.Feature f)

Implements abstract com.fasterxml.jackson.core.JsonGenerator.disable.

Doc from com.fasterxml.jackson.core.JsonGenerator.disable.

Method for disabling specified feature (check Feature for list of features)

Parameters
f:JsonGenerator.Feature

Feature to disable

Returns:JsonGenerator

This generator, to allow call chaining

Annotations
@SuppressWarnings:deprecation
@Override
enableback to summary
public JsonGenerator enable(JsonGenerator.Feature f)

Implements abstract com.fasterxml.jackson.core.JsonGenerator.enable.

Doc from com.fasterxml.jackson.core.JsonGenerator.enable.

Method for enabling specified generator feature: check Feature for list of available features.

Parameters
f:JsonGenerator.Feature

Feature to enable

Returns:JsonGenerator

This generator, to allow call chaining

Annotations
@SuppressWarnings:deprecation
@Override
flushback to summary
public abstract void flush() throws IOException

Redeclares java.io.Flushable.flush.

Implements abstract com.fasterxml.jackson.core.JsonGenerator.flush.

Doc from com.fasterxml.jackson.core.JsonGenerator.flush.

Method called to flush any buffered content to the underlying target (output stream, writer), and to flush the target itself as well.

Annotations
@Override
Exceptions
IOException:
if there is either an underlying I/O problem or encoding issue at format layer
getCodecback to summary
public ObjectCodec getCodec()

Implements abstract com.fasterxml.jackson.core.JsonGenerator.getCodec.

Doc from com.fasterxml.jackson.core.JsonGenerator.getCodec.

Method for accessing the object used for writing Java object as JSON content (using method writeObject).

Returns:ObjectCodec

Codec assigned to this generator, if any; null if none

Annotations
@Override
getFeatureMaskback to summary
public int getFeatureMask()

Implements abstract com.fasterxml.jackson.core.JsonGenerator.getFeatureMask.

Doc from com.fasterxml.jackson.core.JsonGenerator.getFeatureMask.

Bulk access method for getting state of all standard (non-dataformat-specific) JsonGenerator.Features.

Returns:int

Bit mask that defines current states of all standard JsonGenerator.Features.

Annotations
@Override
getOutputContextback to summary
public JsonStreamContext getOutputContext()

Implements abstract com.fasterxml.jackson.core.JsonGenerator.getOutputContext.

Note

type was co-variant until Jackson 2.7; reverted back to base type in 2.8 to allow for overriding by subtypes that use custom context type.

Returns:JsonStreamContext

Doc from com.fasterxml.jackson.core.JsonGenerator.getOutputContext.

Stream output context (JsonStreamContext) associated with this generator

Annotations
@Override
ioContextback to summary
public IOContext ioContext()

Accessor for use by jackson-core itself (tests in particular).

Returns:IOContext

IOContext in use by this generator

Since
2.17
isClosedback to summary
public boolean isClosed()

Implements abstract com.fasterxml.jackson.core.JsonGenerator.isClosed.

Doc from com.fasterxml.jackson.core.JsonGenerator.isClosed.

Method that can be called to determine whether this generator is closed or not. If it is closed, no more output can be done.

Returns:boolean

True if this generator instance has been closed

Annotations
@Override
isEnabledback to summary
public final boolean isEnabled(JsonGenerator.Feature f)

Implements abstract com.fasterxml.jackson.core.JsonGenerator.isEnabled.

Doc from com.fasterxml.jackson.core.JsonGenerator.isEnabled.

Method for checking whether given feature is enabled. Check Feature for list of available features.

Parameters
f:JsonGenerator.Feature

Feature to check

Returns:boolean

True if specified feature is enabled; false if not

Annotations
@Override
overrideStdFeaturesback to summary
public JsonGenerator overrideStdFeatures(int values, int mask)

Overrides com.fasterxml.jackson.core.JsonGenerator.overrideStdFeatures.

Doc from com.fasterxml.jackson.core.JsonGenerator.overrideStdFeatures.

Bulk set method for (re)setting states of features specified by mask. Functionally equivalent to int oldState = getFeatureMask(); int newState = (oldState & ~mask) | (values & mask); setFeatureMask(newState); but preferred as this lets caller more efficiently specify actual changes made.

Parameters
values:int

Bit mask of set/clear state for features to change

mask:int

Bit mask of features to change

Returns:JsonGenerator

This generator, to allow call chaining

Annotations
@Override
setCodecback to summary
public JsonGenerator setCodec(ObjectCodec oc)

Implements abstract com.fasterxml.jackson.core.JsonGenerator.setCodec.

Doc from com.fasterxml.jackson.core.JsonGenerator.setCodec.

Method that can be called to set or reset the object to use for writing Java objects as JsonContent (using method writeObject).

Parameters
oc:ObjectCodec

Codec to assign, if any; null if none

Returns:JsonGenerator

This generator, to allow call chaining

Annotations
@Override
setFeatureMaskback to summary
public JsonGenerator setFeatureMask(int newMask)

Implements abstract com.fasterxml.jackson.core.JsonGenerator.setFeatureMask.

Doc from com.fasterxml.jackson.core.JsonGenerator.setFeatureMask.

Deprecated

Bulk set method for (re)setting states of all standard Features

Parameters
newMask:int

Bitmask that defines which Features are enabled and which disabled

Returns:JsonGenerator

This generator, to allow call chaining

Annotations
@Override
@Deprecated
useDefaultPrettyPrinterback to summary
public JsonGenerator useDefaultPrettyPrinter()

Implements abstract com.fasterxml.jackson.core.JsonGenerator.useDefaultPrettyPrinter.

Doc from com.fasterxml.jackson.core.JsonGenerator.useDefaultPrettyPrinter.

Convenience method for enabling pretty-printing using the default pretty printer (com.fasterxml.jackson.core.util.DefaultPrettyPrinter).

Returns:JsonGenerator

This generator, to allow call chaining

Annotations
@Override
versionback to summary
public Version version()

Implements abstract com.fasterxml.jackson.core.JsonGenerator.version.

Implements com.fasterxml.jackson.core.Versioned.version.

Implemented with standard version number detection algorithm, typically using a simple generated class, with information extracted from Maven project file during build.

Returns:Version

Version number of the generator (version of the jar that contains generator implementation class)

Annotations
@Override
writeBinaryback to summary
public int writeBinary(Base64Variant b64variant, InputStream data, int dataLength) throws IOException

Implements abstract com.fasterxml.jackson.core.JsonGenerator.writeBinary.

Doc from com.fasterxml.jackson.core.JsonGenerator.writeBinary.

Method similar to writeBinary(Base64Variant, byte[], int, int), but where input is provided through a stream, allowing for incremental writes without holding the whole input in memory.

Parameters
b64variant:Base64Variant

Base64 variant to use

data:InputStream

InputStream to use for reading binary data to write. Will not be closed after successful write operation

dataLength:int

(optional) number of bytes that will be available; or -1 to be indicate it is not known. If a positive length is given, 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.

Returns:int

Number of bytes read from data and written as binary payload

Annotations
@Override
Exceptions
IOException:
if there is either an underlying I/O problem or encoding issue at format layer
writeFieldNameback to summary
public void writeFieldName(SerializableString name) throws IOException

Implements abstract com.fasterxml.jackson.core.JsonGenerator.writeFieldName.

Doc from com.fasterxml.jackson.core.JsonGenerator.writeFieldName.

Method similar to 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.

Default implementation simple uses unprocessed name container in serialized String; implementations are strongly encouraged to make use of more efficient methods argument object has.

Parameters
name:SerializableString

Field name to write

Annotations
@Override
Exceptions
IOException:
if there is either an underlying I/O problem or encoding issue at format layer
writeObjectback to summary
public void writeObject(Object value) throws IOException

Implements abstract com.fasterxml.jackson.core.JsonGenerator.writeObject.

Doc from com.fasterxml.jackson.core.JsonGenerator.writeObject.

Older alias for writePOJO(Object)

Parameters
value:Object

Java value (usually POJO) to write

Annotations
@Override
Exceptions
IOException:
if there is either an underlying I/O problem or encoding issue at format layer
writeRawValueback to summary
public void writeRawValue(String text) throws IOException

Implements abstract com.fasterxml.jackson.core.JsonGenerator.writeRawValue.

Doc from com.fasterxml.jackson.core.JsonGenerator.writeRawValue.

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). Assuming this, proper separators are added if and as needed (comma or colon), and generator state updated to reflect this.

Parameters
text:String

Textual contents to included in output

Annotations
@Override
Exceptions
IOException:
if there is either an underlying I/O problem or encoding issue at format layer
writeRawValueback to summary
public void writeRawValue(String text, int offset, int len) throws IOException

Implements abstract com.fasterxml.jackson.core.JsonGenerator.writeRawValue.

Annotations
@Override
writeRawValueback to summary
public void writeRawValue(char[] text, int offset, int len) throws IOException

Implements abstract com.fasterxml.jackson.core.JsonGenerator.writeRawValue.

Annotations
@Override
writeRawValueback to summary
public void writeRawValue(SerializableString text) throws IOException

Overrides com.fasterxml.jackson.core.JsonGenerator.writeRawValue.

Doc from com.fasterxml.jackson.core.JsonGenerator.writeRawValue.

Method similar to writeRawValue(String), but potentially more efficient as it may be able to use pre-encoded content (similar to writeRaw(SerializableString).

Parameters
text:SerializableString

Pre-encoded textual contents to included in output

Annotations
@Override
Exceptions
IOException:
if there is either an underlying I/O problem or encoding issue at format layer
writeStartObjectback to summary
public void writeStartObject(Object forValue) throws IOException

Overrides com.fasterxml.jackson.core.JsonGenerator.writeStartObject.

Doc from com.fasterxml.jackson.core.JsonGenerator.writeStartObject.

Method for writing starting marker of an Object value to represent the given Java Object value. Argument is offered as metadata, but more importantly it should be assigned as the "current value" for the Object content that gets constructed and initialized.

Object values can be written in any context where values are allowed: meaning everywhere except for when a field name is expected.

Parameters
forValue:Object

"Current value" to assign for the Object context being created

Annotations
@Override
Exceptions
IOException:
if there is either an underlying I/O problem or encoding issue at format layer
writeStringback to summary
public void writeString(SerializableString text) throws IOException

Implements abstract com.fasterxml.jackson.core.JsonGenerator.writeString.

Doc from com.fasterxml.jackson.core.JsonGenerator.writeString.

Method similar to 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.

Default implementation just calls writeString(String); sub-classes should override it with more efficient implementation if possible.

Parameters
text:SerializableString

Pre-encoded String value to write

Annotations
@Override
Exceptions
IOException:
if there is either an underlying I/O problem or encoding issue at format layer
writeTreeback to summary
public void writeTree(TreeNode rootNode) throws IOException

Implements abstract com.fasterxml.jackson.core.JsonGenerator.writeTree.

Doc from com.fasterxml.jackson.core.JsonGenerator.writeTree.

Method for writing given JSON tree (expressed as a tree where given JsonNode is the root) using this generator. This will generally just call writeObject with given node, but is added for convenience and to make code more explicit in cases where it deals specifically with trees.

Parameters
rootNode:TreeNode

TreeNode to write

Annotations
@Override
Exceptions
IOException:
if there is either an underlying I/O problem or encoding issue at format layer