Top Description Fields Constructors Methods
tools.jackson.dataformat.csv

public final Enum CsvWriteFeature

extends Enum<CsvWriteFeature>
implements FormatFeature
Class Inheritance
All Implemented Interfaces
tools.jackson.core.FormatFeature, tools.jackson.core.util.JacksonFeature
Imports
tools.jackson.core.FormatFeature

Enumeration that defines all togglable features for CSV writers

Note

in Jackson 2.x this was named CsvGenerator.Feature.

Field Summary

Modifier and TypeField and Description
private final boolean
private final int
public static final CsvWriteFeature
ALWAYS_QUOTE_EMPTY_STRINGS

Feature that determines whether values written as empty Strings (from java.lang.String valued POJO properties) should be forced to be quoted.

public static final CsvWriteFeature
ALWAYS_QUOTE_NUMBERS

Feature that determines whether values written as Nymbers (from java.lang.Number valued POJO properties) should be forced to be quoted, regardless of whether they actually need this.

public static final CsvWriteFeature
ALWAYS_QUOTE_STRINGS

Feature that determines whether values written as Strings (from java.lang.String valued POJO properties) should be forced to be quoted, regardless of whether they actually need this.

public static final CsvWriteFeature
ESCAPE_CONTROL_CHARS_WITH_ESCAPE_CHAR

Feature that determines whether control characters (non-printable) are escaped using the configured escape character.

public static final CsvWriteFeature
ESCAPE_QUOTE_CHAR_WITH_ESCAPE_CHAR

Feature that determines whether quote characters within quoted String values are escaped using configured escape character, instead of being "doubled up" (that is: a quote character is written twice in a row).

public static final CsvWriteFeature
OMIT_MISSING_TAIL_COLUMNS

Feature that determines whether columns without matching value may be omitted, when they are the last values of the row.

public static final CsvWriteFeature
STRICT_CHECK_FOR_QUOTING

Feature that determines how much work is done before determining that a column value requires quoting: when set as true, full check is made to only use quoting when it is strictly necessary; but when false, a faster but more conservative check is made, and possibly quoting is used for values that might not need it.

public static final CsvWriteFeature
WRITE_LINEFEED_AFTER_LAST_ROW

Feature that determines whether a line-feed will be written at the end of content, after the last row of output.

Constructor Summary

AccessConstructor and Description
private
CsvWriteFeature(boolean defaultState)

Method Summary

Modifier and TypeMethod and Description
public static int
collectDefaults()

Method that calculates bit set (flags) of all features that are enabled by default.

public boolean
enabledByDefault()

Implements tools.jackson.core.util.JacksonFeature.enabledByDefault.

Accessor for checking whether this feature is enabled by default.

public boolean
enabledIn(int flags)

Implements tools.jackson.core.util.JacksonFeature.enabledIn.

Convenience method for checking whether feature is enabled in given bitmask.

public int
getMask()

Implements tools.jackson.core.util.JacksonFeature.getMask.

Returns bit mask for this feature instance; must be a single bit, that is of form 1 << N.

public static CsvWriteFeature
public static CsvWriteFeature[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

_defaultStateback to summary
private final boolean _defaultState
_maskback to summary
private final int _mask
ALWAYS_QUOTE_EMPTY_STRINGSback to summary
public static final CsvWriteFeature ALWAYS_QUOTE_EMPTY_STRINGS

Feature that determines whether values written as empty Strings (from java.lang.String valued POJO properties) should be forced to be quoted.

ALWAYS_QUOTE_NUMBERSback to summary
public static final CsvWriteFeature ALWAYS_QUOTE_NUMBERS

Feature that determines whether values written as Nymbers (from java.lang.Number valued POJO properties) should be forced to be quoted, regardless of whether they actually need this.

ALWAYS_QUOTE_STRINGSback to summary
public static final CsvWriteFeature ALWAYS_QUOTE_STRINGS

Feature that determines whether values written as Strings (from java.lang.String valued POJO properties) should be forced to be quoted, regardless of whether they actually need this. Note that this feature has precedence over STRICT_CHECK_FOR_QUOTING, when both would be applicable. Note that this setting does NOT affect quoting of typed values like Numbers or Booleans.

ESCAPE_CONTROL_CHARS_WITH_ESCAPE_CHARback to summary
public static final CsvWriteFeature ESCAPE_CONTROL_CHARS_WITH_ESCAPE_CHAR

Feature that determines whether control characters (non-printable) are escaped using the configured escape character. This feature allows LF and CR characters to be output as

\n
and
\r
instead of being echoed out. This is a compatibility feature for some parsers that can not read such output back in.

Default value is false so that control characters are echoed out (backwards compatible).

ESCAPE_QUOTE_CHAR_WITH_ESCAPE_CHARback to summary
public static final CsvWriteFeature ESCAPE_QUOTE_CHAR_WITH_ESCAPE_CHAR

Feature that determines whether quote characters within quoted String values are escaped using configured escape character, instead of being "doubled up" (that is: a quote character is written twice in a row).

Default value is false so that quotes are doubled as necessary, not escaped.

OMIT_MISSING_TAIL_COLUMNSback to summary
public static final CsvWriteFeature OMIT_MISSING_TAIL_COLUMNS

Feature that determines whether columns without matching value may be omitted, when they are the last values of the row. If true, values and separators between values may be omitted, to slightly reduce length of the row; if false, separators need to stay in place and values are indicated by empty Strings.

STRICT_CHECK_FOR_QUOTINGback to summary
public static final CsvWriteFeature STRICT_CHECK_FOR_QUOTING

Feature that determines how much work is done before determining that a column value requires quoting: when set as true, full check is made to only use quoting when it is strictly necessary; but when false, a faster but more conservative check is made, and possibly quoting is used for values that might not need it. Trade-offs is basically between optimal/minimal quoting (true), and faster handling (false). Faster check involves only checking first N characters of value, as well as possible looser checks.

Note, however, that regardless setting, all values that need to be quoted will be: it is just that when set to false, other values may also be quoted (to avoid having to do more expensive checks).

Default value is false for "loose" (approximate, conservative) checking.

WRITE_LINEFEED_AFTER_LAST_ROWback to summary
public static final CsvWriteFeature WRITE_LINEFEED_AFTER_LAST_ROW

Feature that determines whether a line-feed will be written at the end of content, after the last row of output.

Note

When disabling this feature it is important that CsvGenerator#flush() is NOT called before CsvGenerator#close() is called; the current implementation relies on ability to essentially remove the last linefeed that was appended in the output buffer.

Default value is true so all rows, including the last, are terminated by a line feed.

Constructor Detail

CsvWriteFeatureback to summary
private CsvWriteFeature(boolean defaultState)

Method Detail

collectDefaultsback to summary
public static int collectDefaults()

Method that calculates bit set (flags) of all features that are enabled by default.

enabledByDefaultback to summary
public boolean enabledByDefault()

Implements tools.jackson.core.util.JacksonFeature.enabledByDefault.

Doc from tools.jackson.core.util.JacksonFeature.enabledByDefault.

Accessor for checking whether this feature is enabled by default.

Annotations
@Override
enabledInback to summary
public boolean enabledIn(int flags)

Implements tools.jackson.core.util.JacksonFeature.enabledIn.

Doc from tools.jackson.core.util.JacksonFeature.enabledIn.

Convenience method for checking whether feature is enabled in given bitmask.

Annotations
@Override
getMaskback to summary
public int getMask()

Implements tools.jackson.core.util.JacksonFeature.getMask.

Doc from tools.jackson.core.util.JacksonFeature.getMask.

Returns bit mask for this feature instance; must be a single bit, that is of form 1 << N.

Annotations
@Override
valueOfback to summary
public static CsvWriteFeature valueOf(String name)
valuesback to summary
public static CsvWriteFeature[] values()