Top Fields Constructors Methods
tools.jackson.dataformat.avro

public Class AvroGenerator

extends GeneratorBase
Class Inheritance
Imports
java.io.IOException, .OutputStream, java.math.BigDecimal, .BigInteger, java.nio.charset.StandardCharsets, java.util.Objects, org.apache.avro.io.BinaryEncoder, .EncoderFactory, tools.jackson.core.*, tools.jackson.core.base.GeneratorBase, tools.jackson.core.io.IOContext, tools.jackson.core.util.JacksonFeatureSet, tools.jackson.dataformat.avro.apacheimpl.ApacheCodecRecycler, tools.jackson.dataformat.avro.ser.AvroWriteContext, .EncodedDatum

Field Summary

Modifier and TypeField and Description
protected ApacheCodecRecycler
protected boolean
_complete

Flag that is set when the whole content is complete, can be output.

protected BinaryEncoder
_encoder

Lazily constructed encoder; reused in case of writing root-value sequences.

protected int
_formatWriteFeatures

Bit flag composed of bits that indicate which AvroWriteFeatures are enabled.

protected final OutputStream
protected AvroWriteContext
_rootContext

Reference to the root context since that is needed for serialization

protected final AvroSchema
protected AvroWriteContext
_streamWriteContext

Current context

protected static final EncoderFactory
Inherited from tools.jackson.core.base.GeneratorBase:
_closed_ioContext_objectWriteContext_streamWriteConstraints_streamWriteFeaturesDEFAULT_BINARY_WRITE_CAPABILITIESDEFAULT_TEXTUAL_WRITE_CAPABILITIESDEFAULT_WRITE_CAPABILITIESMAX_BIG_DECIMAL_SCALESURR1_FIRSTSURR1_LASTSURR2_FIRSTSURR2_LASTWRITE_BINARYWRITE_BOOLEANWRITE_NULLWRITE_NUMBERWRITE_RAWWRITE_STRING

Constructor Summary

AccessConstructor and Description
public
AvroGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, int streamWriteFeatures, int avroFeatures, ApacheCodecRecycler apacheCodecRecycler, AvroSchema schema, OutputStream output)

Method Summary

Modifier and TypeMethod and Description
protected void
protected void
protected void
_releaseBuffers()

Implements abstract tools.jackson.core.base.GeneratorBase._releaseBuffers.

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

protected final void
_verifyValueWrite(String typeMsg)

Implements abstract tools.jackson.core.base.GeneratorBase._verifyValueWrite.

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 v)

Implements abstract tools.jackson.core.JsonGenerator.assignCurrentValue.

Helper method, usually equivalent to: getOutputContext().assignCurrentValue(v); used to assign "current value" for the current context of this generator.

public AvroGenerator
configure(AvroWriteFeature f, boolean state)

public Object
currentValue()

Implements abstract tools.jackson.core.JsonGenerator.currentValue.

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

Note that "current value" is NOT populated (or used) by Streaming generator; it is only used by higher-level data-binding functionality.

public AvroGenerator
public AvroGenerator
public final void
flush()

Implements abstract tools.jackson.core.JsonGenerator.flush.

Implements java.io.Flushable.flush.

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

public PrettyPrinter
getPrettyPrinter()

Overrides tools.jackson.core.JsonGenerator.getPrettyPrinter.

Accessor for object that handles pretty-printing (usually additional white space to make results more human-readable) during output.

public AvroSchema
getSchema()

Overrides tools.jackson.core.JsonGenerator.getSchema.

Method for accessing Schema that this generator uses, if any.

public final boolean
public JacksonFeatureSet<StreamWriteCapability>
streamWriteCapabilities()

Implements abstract tools.jackson.core.JsonGenerator.streamWriteCapabilities.

Accessor for getting metadata on capabilities of this generator, based on underlying data format being read (directly or indirectly).

public TokenStreamContext
streamWriteContext()

Implements abstract tools.jackson.core.JsonGenerator.streamWriteContext.

Accessor for context object that provides information about low-level logical position withing output token stream.

public int
streamWriteOutputBuffered()

Implements abstract tools.jackson.core.JsonGenerator.streamWriteOutputBuffered.

Unfortunately we have no visibility into buffering Avro codec does; and need to return -1 to reflect that lack of knowledge.

public Object
streamWriteOutputTarget()

Implements abstract tools.jackson.core.JsonGenerator.streamWriteOutputTarget.

Method that can be used to get access to object that is used as target for generated output; this is usually either java.io.OutputStream or java.io.Writer, depending on what generator was constructed with.

public Version
version()

Implements abstract tools.jackson.core.JsonGenerator.version.

Implements tools.jackson.core.Versioned.version.

Accessor for finding out version of the bundle that provided this generator instance.

public JsonGenerator
writeBinary(Base64Variant b64variant, byte[] data, int offset, int len)

Implements abstract tools.jackson.core.JsonGenerator.writeBinary.

Method that will output given chunk of binary data as base64 encoded, as a complete String value (surrounded by double quotes).

public JsonGenerator
writeBoolean(boolean state)

Implements abstract tools.jackson.core.JsonGenerator.writeBoolean.

Method for outputting literal JSON boolean value (one of Strings 'true' and 'false').

public JsonGenerator
writeEmbeddedObject(Object object)

Overrides tools.jackson.core.JsonGenerator.writeEmbeddedObject.

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 JsonGenerator
writeEndArray()

Implements abstract tools.jackson.core.JsonGenerator.writeEndArray.

Method for writing closing marker of a JSON Array value (character ']'; plus possible white space decoration if pretty-printing is enabled).

public JsonGenerator
writeEndObject()

Implements abstract tools.jackson.core.JsonGenerator.writeEndObject.

Method for writing closing marker of an Object value (character '}'; plus possible white space decoration if pretty-printing is enabled).

public JsonGenerator
writeName(String name)

Implements abstract tools.jackson.core.JsonGenerator.writeName.

Method for writing an Object Property 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 JsonGenerator
writeName(SerializableString name)

Overrides tools.jackson.core.base.GeneratorBase.writeName.

Method similar to writeName(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 JsonGenerator
writeNull()

Implements abstract tools.jackson.core.JsonGenerator.writeNull.

Method for outputting literal JSON null value.

public JsonGenerator
writeNumber(short v)

Implements abstract tools.jackson.core.JsonGenerator.writeNumber.

Method for outputting given value as JSON number.

public JsonGenerator
writeNumber(int v)

Implements abstract tools.jackson.core.JsonGenerator.writeNumber.

Method for outputting given value as JSON number.

public JsonGenerator
writeNumber(long v)

Implements abstract tools.jackson.core.JsonGenerator.writeNumber.

Method for outputting given value as JSON number.

public JsonGenerator
writeNumber(BigInteger v)

Implements abstract tools.jackson.core.JsonGenerator.writeNumber.

Method for outputting given value as JSON number.

public JsonGenerator
writeNumber(double d)

Implements abstract tools.jackson.core.JsonGenerator.writeNumber.

Method for outputting indicate JSON numeric value.

public JsonGenerator
writeNumber(float f)

Implements abstract tools.jackson.core.JsonGenerator.writeNumber.

Method for outputting indicate JSON numeric value.

public JsonGenerator
writeNumber(BigDecimal dec)

Implements abstract tools.jackson.core.JsonGenerator.writeNumber.

Method for outputting indicate JSON numeric value.

public JsonGenerator
writeNumber(String encodedValue)

Implements abstract tools.jackson.core.JsonGenerator.writeNumber.

Write method that can be used for custom numeric types that can not be (easily?) converted to "standard" Java number types.

public JsonGenerator
writePropertyId(long id)

Implements abstract tools.jackson.core.JsonGenerator.writePropertyId.

Alternative to writeName(String) that may be used in cases where Object Property key is of numeric type; usually where underlying format supports such notion (some binary formats do, unlike JSON).

public JsonGenerator
writeRaw(String text)

Implements abstract tools.jackson.core.JsonGenerator.writeRaw.

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

Implements abstract tools.jackson.core.JsonGenerator.writeRaw.

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 JsonGenerator
writeRaw(char[] text, int offset, int len)

Implements abstract tools.jackson.core.JsonGenerator.writeRaw.

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 JsonGenerator
writeRaw(char c)

Implements abstract tools.jackson.core.JsonGenerator.writeRaw.

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 JsonGenerator
writeRawUTF8String(byte[] text, int offset, int len)

Implements abstract tools.jackson.core.JsonGenerator.writeRawUTF8String.

Method similar to 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 JsonGenerator
writeRawValue(String text)

Overrides tools.jackson.core.base.GeneratorBase.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 JsonGenerator
public JsonGenerator
writeRawValue(char[] text, int offset, int len)

Overrides tools.jackson.core.base.GeneratorBase.writeRawValue.

public JsonGenerator
writeStartArray()

Implements abstract tools.jackson.core.JsonGenerator.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 JsonGenerator
writeStartArray(Object currValue)

Implements abstract tools.jackson.core.JsonGenerator.writeStartArray.

Method for writing start marker of an Array value, similar to writeStartArray(), but also specifying what is the Java object that the Array Object being written represents (if any); null may be passed if not known or not applicable.

public JsonGenerator
writeStartArray(Object currValue, int len)

Overrides tools.jackson.core.base.GeneratorBase.writeStartArray.

Method for writing start marker of an Array value, similar to writeStartArray(), but also specifying what is the Java object that the Array Object being written represents (if any) and how many elements will be written for the array before calling writeEndArray().

public JsonGenerator
writeStartObject()

Implements abstract tools.jackson.core.JsonGenerator.writeStartObject.

Method for writing starting marker of an Object value (character '{'; plus possible white space decoration if pretty-printing is enabled).

public JsonGenerator
writeStartObject(Object forValue)

Implements abstract tools.jackson.core.JsonGenerator.writeStartObject.

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

public JsonGenerator
writeString(String text)

Implements abstract tools.jackson.core.JsonGenerator.writeString.

Method for outputting a String value.

public JsonGenerator
writeString(char[] text, int offset, int len)

Implements abstract tools.jackson.core.JsonGenerator.writeString.

Method for outputting a String value.

public JsonGenerator
writeString(SerializableString sstr)

Overrides tools.jackson.core.base.GeneratorBase.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 JsonGenerator
writeUTF8String(byte[] text, int offset, int len)

Implements abstract tools.jackson.core.JsonGenerator.writeUTF8String.

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

Inherited from tools.jackson.core.base.GeneratorBase:
_asString_checkRangeBoundsForByteArray_checkRangeBoundsForCharArray_checkRangeBoundsForString_constructDefaultPrettyPrinter_decodeSurrogate_throwInternalcloseconfigurehasioContextisClosedisEnabledobjectWriteContextstreamWriteConstraintsstreamWriteFeatureswriteBinarywritePOJOwriteRawValuewriteStartObjectwriteStringwriteTree

Field Detail

_apacheCodecRecyclerback to summary
protected ApacheCodecRecycler _apacheCodecRecycler
Since
2.16
_completeback to summary
protected boolean _complete

Flag that is set when the whole content is complete, can be output.

_encoderback to summary
protected BinaryEncoder _encoder

Lazily constructed encoder; reused in case of writing root-value sequences.

_formatWriteFeaturesback to summary
protected int _formatWriteFeatures

Bit flag composed of bits that indicate which AvroWriteFeatures are enabled.

_outputback to summary
protected final OutputStream _output
_rootContextback to summary
protected AvroWriteContext _rootContext

Reference to the root context since that is needed for serialization

_rootSchemaback to summary
protected final AvroSchema _rootSchema
_streamWriteContextback to summary
protected AvroWriteContext _streamWriteContext

Current context

ENCODER_FACTORYback to summary
protected static final EncoderFactory ENCODER_FACTORY
Since
2.16

Constructor Detail

AvroGeneratorback to summary
public AvroGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, int streamWriteFeatures, int avroFeatures, ApacheCodecRecycler apacheCodecRecycler, AvroSchema schema, OutputStream output) throws JacksonException

Method Detail

_closeInputback to summary
protected void _closeInput() throws IOException

Implements abstract tools.jackson.core.base.GeneratorBase._closeInput.

Annotations
@Override
_completeback to summary
protected void _complete() throws JacksonException
_releaseBuffersback to summary
protected void _releaseBuffers()

Implements abstract tools.jackson.core.base.GeneratorBase._releaseBuffers.

Doc from tools.jackson.core.base.GeneratorBase._releaseBuffers.

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

Annotations
@Override
_verifyValueWriteback to summary
protected final void _verifyValueWrite(String typeMsg) throws JacksonException

Implements abstract tools.jackson.core.base.GeneratorBase._verifyValueWrite.

Doc from tools.jackson.core.base.GeneratorBase._verifyValueWrite.

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.

Annotations
@Override
Exceptions
JacksonException:
if there is a problem in trying to write a value
assignCurrentValueback to summary
public void assignCurrentValue(Object v)

Implements abstract tools.jackson.core.JsonGenerator.assignCurrentValue.

Doc from tools.jackson.core.JsonGenerator.assignCurrentValue.

Helper method, usually equivalent to: getOutputContext().assignCurrentValue(v); used to assign "current value" for the current context of this generator. It is usually assigned and used by higher level data-binding functionality (instead of streaming parsers/generators) but is stored at streaming level.

Annotations
@Override
configureback to summary
public AvroGenerator configure(AvroWriteFeature f, boolean state)
currentValueback to summary
public Object currentValue()

Implements abstract tools.jackson.core.JsonGenerator.currentValue.

Doc from tools.jackson.core.JsonGenerator.currentValue.

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

Note that "current value" is NOT populated (or used) by Streaming generator; 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.

Annotations
@Override
disableback to summary
public AvroGenerator disable(AvroWriteFeature f)
enableback to summary
public AvroGenerator enable(AvroWriteFeature f)
flushback to summary
public final void flush()

Implements abstract tools.jackson.core.JsonGenerator.flush.

Implements java.io.Flushable.flush.

Doc from tools.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
getPrettyPrinterback to summary
public PrettyPrinter getPrettyPrinter()

Overrides tools.jackson.core.JsonGenerator.getPrettyPrinter.

Doc from tools.jackson.core.JsonGenerator.getPrettyPrinter.

Accessor for object that handles pretty-printing (usually additional white space to make results more human-readable) during output. If null, no pretty-printing is done.

Note

this may be PrettyPrinter that TokenStreamFactory was configured with (if stateless), OR an instance created via tools.jackson.core.util.Instantiatable#createInstance() (if stateful).

Default implementation returns null so pretty-printing capable generators need to override it.

Annotations
@Override
getSchemaback to summary
public AvroSchema getSchema()

Overrides tools.jackson.core.JsonGenerator.getSchema.

Doc from tools.jackson.core.JsonGenerator.getSchema.

Method for accessing Schema that this generator uses, if any. Default implementation returns null.

Annotations
@Override
isEnabledback to summary
public final boolean isEnabled(AvroWriteFeature f)
streamWriteCapabilitiesback to summary
public JacksonFeatureSet<StreamWriteCapability> streamWriteCapabilities()

Implements abstract tools.jackson.core.JsonGenerator.streamWriteCapabilities.

Doc from tools.jackson.core.JsonGenerator.streamWriteCapabilities.

Accessor for getting metadata on capabilities of this generator, based on underlying data format being read (directly or indirectly).

Annotations
@Override
streamWriteContextback to summary
public TokenStreamContext streamWriteContext()

Implements abstract tools.jackson.core.JsonGenerator.streamWriteContext.

Doc from tools.jackson.core.JsonGenerator.streamWriteContext.

Accessor for context object that provides information about low-level logical position withing output token stream.

Note

method was called getOutputContext() in Jackson 2.x

Annotations
@Override
streamWriteOutputBufferedback to summary
public int streamWriteOutputBuffered()

Implements abstract tools.jackson.core.JsonGenerator.streamWriteOutputBuffered.

Unfortunately we have no visibility into buffering Avro codec does; and need to return -1 to reflect that lack of knowledge.

Annotations
@Override
streamWriteOutputTargetback to summary
public Object streamWriteOutputTarget()

Implements abstract tools.jackson.core.JsonGenerator.streamWriteOutputTarget.

Doc from tools.jackson.core.JsonGenerator.streamWriteOutputTarget.

Method that can be used to get access to object that is used as target for generated output; this is usually either java.io.OutputStream or java.io.Writer, depending on what generator was constructed with. Note that returned value may be null in some cases; including case where implementation does not want to exposed raw source to caller. In cases where output has been decorated, object returned here is the decorated version; this allows some level of interaction between users of generator and decorator object.

In general use of this accessor should be considered as "last effort", i.e. only used if no other mechanism is applicable.

Note

was named getOutputTarget() in Jackson 2.x.

Annotations
@Override
versionback to summary
public Version version()

Implements abstract tools.jackson.core.JsonGenerator.version.

Implements tools.jackson.core.Versioned.version.

Doc from tools.jackson.core.JsonGenerator.version.

Accessor for finding out version of the bundle that provided this generator instance.

Annotations
@Override
writeBinaryback to summary
public JsonGenerator writeBinary(Base64Variant b64variant, byte[] data, int offset, int len) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeBinary.

Doc from tools.jackson.core.JsonGenerator.writeBinary.

Method that will output given chunk of binary data as base64 encoded, as a complete String value (surrounded by double quotes). This method defaults

Note

because JSON Strings cannot contain unescaped linefeeds, if linefeeds are included (as per last argument), they must be escaped. This adds overhead for decoding without improving readability. Alternatively if linefeeds are not included, resulting String value may violate the requirement of base64 RFC which mandates line-length of 76 characters and use of linefeeds. However, all JsonParser implementations are required to accept such "long line base64"; as do typical production-level base64 decoders.

Annotations
@Override
writeBooleanback to summary
public JsonGenerator writeBoolean(boolean state) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeBoolean.

Doc from tools.jackson.core.JsonGenerator.writeBoolean.

Method for outputting literal JSON boolean value (one of Strings 'true' and 'false'). Can be called in any context where a value is expected (Array value, Object property value, root-level value). Additional white space may be added around the value if pretty-printing is enabled.

Annotations
@Override
writeEmbeddedObjectback to summary
public JsonGenerator writeEmbeddedObject(Object object) throws JacksonException

Overrides tools.jackson.core.JsonGenerator.writeEmbeddedObject.

Doc from tools.jackson.core.JsonGenerator.writeEmbeddedObject.

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.

Note

this is NOT the method to call for serializing regular POJOs, see writePOJO instead.

Annotations
@Override
writeEndArrayback to summary
public JsonGenerator writeEndArray() throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeEndArray.

Doc from tools.jackson.core.JsonGenerator.writeEndArray.

Method for writing closing marker of a JSON Array value (character ']'; plus possible white space decoration if pretty-printing is enabled).

Marker can be written if the innermost structured type is Array.

Annotations
@Override
writeEndObjectback to summary
public JsonGenerator writeEndObject() throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeEndObject.

Doc from tools.jackson.core.JsonGenerator.writeEndObject.

Method for writing closing marker of an Object value (character '}'; plus possible white space decoration if pretty-printing is enabled).

Marker can be written if the innermost structured type is Object, and the last written event was either a complete value, or START-OBJECT marker (see JSON specification for more details).

Annotations
@Override
writeNameback to summary
public JsonGenerator writeName(String name) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeName.

Doc from tools.jackson.core.JsonGenerator.writeName.

Method for writing an Object Property name (JSON String surrounded by double quotes: syntactically identical to a JSON String value), possibly decorated by white space if pretty-printing is enabled.

Property names can only be written in Object context (check out JSON specification for details), when Object Property name is expected (property names alternate with values).

Annotations
@Override
writeNameback to summary
public JsonGenerator writeName(SerializableString name) throws JacksonException

Overrides tools.jackson.core.base.GeneratorBase.writeName.

Doc from tools.jackson.core.JsonGenerator.writeName.

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

Annotations
@Override
writeNullback to summary
public JsonGenerator writeNull() throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeNull.

Doc from tools.jackson.core.JsonGenerator.writeNull.

Method for outputting literal JSON null value. Can be called in any context where a value is expected (Array value, Object property value, root-level value). Additional white space may be added around the value if pretty-printing is enabled.

Annotations
@Override
writeNumberback to summary
public JsonGenerator writeNumber(short v) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeNumber.

Doc from tools.jackson.core.JsonGenerator.writeNumber.

Method for outputting given value as JSON number. Can be called in any context where a value is expected (Array value, Object property value, root-level value). Additional white space may be added around the value if pretty-printing is enabled.

Annotations
@Override
writeNumberback to summary
public JsonGenerator writeNumber(int v) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeNumber.

Doc from tools.jackson.core.JsonGenerator.writeNumber.

Method for outputting given value as JSON number. Can be called in any context where a value is expected (Array value, Object property value, root-level value). Additional white space may be added around the value if pretty-printing is enabled.

Annotations
@Override
writeNumberback to summary
public JsonGenerator writeNumber(long v) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeNumber.

Doc from tools.jackson.core.JsonGenerator.writeNumber.

Method for outputting given value as JSON number. Can be called in any context where a value is expected (Array value, Object property value, root-level value). Additional white space may be added around the value if pretty-printing is enabled.

Annotations
@Override
writeNumberback to summary
public JsonGenerator writeNumber(BigInteger v) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeNumber.

Doc from tools.jackson.core.JsonGenerator.writeNumber.

Method for outputting given value as JSON number. Can be called in any context where a value is expected (Array value, Object property value, root-level value). Additional white space may be added around the value if pretty-printing is enabled.

Annotations
@Override
writeNumberback to summary
public JsonGenerator writeNumber(double d) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeNumber.

Doc from tools.jackson.core.JsonGenerator.writeNumber.

Method for outputting indicate JSON numeric value. Can be called in any context where a value is expected (Array value, Object property value, root-level value). Additional white space may be added around the value if pretty-printing is enabled.

Annotations
@Override
writeNumberback to summary
public JsonGenerator writeNumber(float f) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeNumber.

Doc from tools.jackson.core.JsonGenerator.writeNumber.

Method for outputting indicate JSON numeric value. Can be called in any context where a value is expected (Array value, Object property value, root-level value). Additional white space may be added around the value if pretty-printing is enabled.

Annotations
@Override
writeNumberback to summary
public JsonGenerator writeNumber(BigDecimal dec) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeNumber.

Doc from tools.jackson.core.JsonGenerator.writeNumber.

Method for outputting indicate JSON numeric value. Can be called in any context where a value is expected (Array value, Object property value, root-level value). Additional white space may be added around the value if pretty-printing is enabled.

Annotations
@Override
writeNumberback to summary
public JsonGenerator writeNumber(String encodedValue) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeNumber.

Doc from tools.jackson.core.JsonGenerator.writeNumber.

Write method that can be used for custom numeric types that can not be (easily?) converted to "standard" Java number types. Because numbers are not surrounded by double quotes, regular writeString method cannot be used; nor writeRaw because that does not properly handle value separators needed in Array or Object contexts.

Note

because of lack of type safety, some generator implementations may not be able to implement this method. For example, if a binary JSON format is used, it may require type information for encoding; similarly for generator-wrappers around Java objects or JSON nodes. If implementation does not implement this method, it needs to throw UnsupportedOperationException.

Annotations
@Override
writePropertyIdback to summary
public JsonGenerator writePropertyId(long id) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writePropertyId.

Doc from tools.jackson.core.JsonGenerator.writePropertyId.

Alternative to writeName(String) that may be used in cases where Object Property key is of numeric type; usually where underlying format supports such notion (some binary formats do, unlike JSON). Default implementation will simply convert id into String and call writeName(String).

Annotations
@Override
writeRawback to summary
public JsonGenerator writeRaw(String text) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeRaw.

Doc from tools.jackson.core.JsonGenerator.writeRaw.

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). If such separators are desired, use writeRawValue(String) instead.

Note that not all generator implementations necessarily support such by-pass methods: those that do not will throw UnsupportedOperationException.

Annotations
@Override
writeRawback to summary
public JsonGenerator writeRaw(String text, int offset, int len) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeRaw.

Doc from tools.jackson.core.JsonGenerator.writeRaw.

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). If such separators are desired, use writeRawValue(String) instead.

Note that not all generator implementations necessarily support such by-pass methods: those that do not will throw UnsupportedOperationException.

Annotations
@Override
writeRawback to summary
public JsonGenerator writeRaw(char[] text, int offset, int len) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeRaw.

Doc from tools.jackson.core.JsonGenerator.writeRaw.

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). If such separators are desired, use writeRawValue(String) instead.

Note that not all generator implementations necessarily support such by-pass methods: those that do not will throw UnsupportedOperationException.

Annotations
@Override
writeRawback to summary
public JsonGenerator writeRaw(char c) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeRaw.

Doc from tools.jackson.core.JsonGenerator.writeRaw.

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). If such separators are desired, use writeRawValue(String) instead.

Note that not all generator implementations necessarily support such by-pass methods: those that do not will throw UnsupportedOperationException.

Annotations
@Override
writeRawUTF8Stringback to summary
public JsonGenerator writeRawUTF8String(byte[] text, int offset, int len) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeRawUTF8String.

Doc from tools.jackson.core.JsonGenerator.writeRawUTF8String.

Method similar to 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). However, quoting that data format requires (like double-quotes for JSON) will be added around the value if and as necessary.

Note that some backends may choose not to support this method: for example, if underlying destination is a java.io.Writer using this method would require UTF-8 decoding. If so, implementation may instead choose to throw a UnsupportedOperationException due to ineffectiveness of having to decode input.

Annotations
@Override
writeRawValueback to summary
public JsonGenerator writeRawValue(String text) throws JacksonException

Overrides tools.jackson.core.base.GeneratorBase.writeRawValue.

Doc from tools.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.

Annotations
@Override
writeRawValueback to summary
public JsonGenerator writeRawValue(String text, int offset, int len) throws JacksonException

Overrides tools.jackson.core.base.GeneratorBase.writeRawValue.

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

Overrides tools.jackson.core.base.GeneratorBase.writeRawValue.

Annotations
@Override
writeStartArrayback to summary
public JsonGenerator writeStartArray() throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeStartArray.

Doc from tools.jackson.core.JsonGenerator.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).

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

Annotations
@Override
writeStartArrayback to summary
public JsonGenerator writeStartArray(Object currValue) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeStartArray.

Doc from tools.jackson.core.JsonGenerator.writeStartArray.

Method for writing start marker of an Array value, similar to writeStartArray(), but also specifying what is the Java object that the Array Object being written represents (if any); null may be passed if not known or not applicable. This value is accessible from context as "current value"

Annotations
@Override
writeStartArrayback to summary
public JsonGenerator writeStartArray(Object currValue, int len) throws JacksonException

Overrides tools.jackson.core.base.GeneratorBase.writeStartArray.

Doc from tools.jackson.core.JsonGenerator.writeStartArray.

Method for writing start marker of an Array value, similar to writeStartArray(), but also specifying what is the Java object that the Array Object being written represents (if any) and how many elements will be written for the array before calling writeEndArray().

Annotations
@Override
writeStartObjectback to summary
public JsonGenerator writeStartObject() throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeStartObject.

Doc from tools.jackson.core.JsonGenerator.writeStartObject.

Method for writing starting marker of an Object value (character '{'; plus possible white space decoration if pretty-printing is enabled).

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

Annotations
@Override
writeStartObjectback to summary
public JsonGenerator writeStartObject(Object forValue) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeStartObject.

Doc from tools.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 property name is expected.

Annotations
@Override
writeStringback to summary
public JsonGenerator writeString(String text) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeString.

Doc from tools.jackson.core.JsonGenerator.writeString.

Method for outputting a String value. Depending on context this means either array element, (object) property value or a stand-alone (root-level value) String; but in all cases, String will be surrounded in double quotes, and contents will be properly escaped as required by JSON specification.

Annotations
@Override
writeStringback to summary
public JsonGenerator writeString(char[] text, int offset, int len) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeString.

Doc from tools.jackson.core.JsonGenerator.writeString.

Method for outputting a String value. Depending on context this means either array element, (object) property value or a stand alone String; but in all cases, String will be surrounded in double quotes, and contents will be properly escaped as required by JSON specification.

Annotations
@Override
writeStringback to summary
public JsonGenerator writeString(SerializableString sstr) throws JacksonException

Overrides tools.jackson.core.base.GeneratorBase.writeString.

Doc from tools.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.

Annotations
@Override
writeUTF8Stringback to summary
public JsonGenerator writeUTF8String(byte[] text, int offset, int len) throws JacksonException

Implements abstract tools.jackson.core.JsonGenerator.writeUTF8String.

Doc from tools.jackson.core.JsonGenerator.writeUTF8String.

Method similar to 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). This means that textual JSON backends need to check if value needs JSON escaping, but otherwise can just be copied as is to output. Also, quoting that data format requires (like double-quotes for JSON) will be added around the value if and as necessary.

Note that some backends may choose not to support this method: for example, if underlying destination is a java.io.Writer using this method would require UTF-8 decoding. In this case generator implementation may instead choose to throw a UnsupportedOperationException due to ineffectiveness of having to decode input.

Annotations
@Override