Top Fields Constructors Methods
tools.jackson.dataformat.csv

public Class CsvGenerator

extends GeneratorBase
Class Inheritance
Imports
java.io.*, java.math.BigDecimal, .BigInteger, java.nio.charset.StandardCharsets, java.util.Arrays, tools.jackson.core.*, tools.jackson.core.base.GeneratorBase, tools.jackson.core.io.CharacterEscapes, .IOContext, tools.jackson.core.json.DupDetector, tools.jackson.core.util.SimpleStreamWriteContext, .JacksonFeatureSet, tools.jackson.dataformat.csv.impl.CsvEncoder

Field Summary

Modifier and TypeField and Description
protected StringBuilder
_arrayContents

Accumulated contents of an array cell, if any

protected int
_arrayElements

Additional counter that indicates number of value entries in the array.

protected String
_arraySeparator

Separator to use during writing of (simple) array value, to be encoded as a single column value, if any.

protected final int
_formatFeatures

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

protected boolean
_handleFirstLine

Flag that indicates that we need to write header line, if one is needed.

protected int
_nextColumnByName

Index of column that we will be getting next, based on the property name call that was made.

protected CsvValueDecorator
_nextColumnDecorator

Decorator to use for decorating the column value to follow, if any; null if none.

protected final CsvSchema
_schema

Definition of columns being written, if available.

protected boolean
_skipValue

Flag set when property to write is unknown, and the matching value is to be skipped quietly.

protected SimpleStreamWriteContext
_skipWithin

When skipping output (for "unknown" output), outermost write context where skipping should occur

protected SimpleStreamWriteContext
_streamWriteContext

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

protected CsvEncoder
private static final CsvSchema
protected static final long
protected static final long
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
CsvGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, int streamWriteFeatures, int csvFeatures, Writer out, CsvSchema schema, CsvCharacterEscapes characterEscapes)

public
CsvGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, int streamWriteFeatures, int csvFeatures, CsvEncoder csvWriter)

Method Summary

Modifier and TypeMethod and Description
protected void
protected void
_addToArray(char[] value)

protected void
protected final int
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 void
_reportCsvWriteError(String msg)

Method called when there is a problem related to mapping data (compared to a low-level generation); if so, should be surfaced as

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.

private final void
public final 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 boolean
canOmitProperties()

Overrides tools.jackson.core.JsonGenerator.canOmitProperties.

Introspection method to call to check whether it is ok to omit writing of Object properties or not.

public void
close()

Overrides tools.jackson.core.base.GeneratorBase.close.

Implements java.io.Closeable.close.

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

public final 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.

protected void
finishRow()

Method called when the current row is complete; typically will flush possibly buffered column values, append linefeed and reset state appropriately.

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 CharacterEscapes
getCharacterEscapes()

Overrides tools.jackson.core.JsonGenerator.getCharacterEscapes.

Method for accessing custom escapes generator uses for JsonGenerators it creates.

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 final boolean
public CsvGenerator
setCharacterEscapes(CharacterEscapes esc)

Overrides tools.jackson.core.JsonGenerator.setCharacterEscapes.

Method for defining custom escapes factory uses for JsonGenerators it creates.

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 final 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.

Note

while this method will return some information on amount of data buffered, it may be an incomplete view as some buffering happens at a higher level, as not-yet-serialized values.

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

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

Method for outputting indicate JSON numeric value.

public JsonGenerator
writeNumber(float v)

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

Method for outputting indicate JSON numeric value.

public JsonGenerator
writeNumber(BigDecimal v)

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
writeOmittedProperty(String propName)

Overrides tools.jackson.core.JsonGenerator.writeOmittedProperty.

Method called to indicate that a property in this position was skipped.

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

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_throwInternalconfigurehasioContextisClosedisEnabledobjectWriteContextstreamWriteConstraintsstreamWriteFeatureswriteBinarywritePOJOwriteRawValuewriteStartArraywriteStartObjectwriteStringwriteTree