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

public final Enum CBORWriteFeature

extends Enum<CBORWriteFeature>
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 CBOR generator.

Note

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

Field Summary

Modifier and TypeField and Description
private final boolean
private final int
public static final CBORWriteFeature
ENCODE_USING_STANDARD_NEGATIVE_BIGINT_ENCODING

Feature that determines how binary tagged negative BigInteger values are encoded: either using CBOR standard encoding logic (as per spec), or using legacy Jackson encoding logic (encoding up to Jackson 2.19).

public static final CBORWriteFeature
LENIENT_UTF_ENCODING

Feature that determines if an invalid surrogate encoding found in the incoming String should fail with an exception or silently be output as the Unicode 'REPLACEMENT CHARACTER' (U+FFFD) or not; if not, an exception will be thrown to indicate invalid content.

public static final CBORWriteFeature
STRINGREF

Feature that determines if string references are generated based on the stringref) extension.

public static final CBORWriteFeature
WRITE_MINIMAL_DOUBLES

Feature that determines whether generator should try to write doubles as floats: if true, will write a double as a 4-byte float if no precision loss will occur; if false, will always write a double as an 8-byte double.

public static final CBORWriteFeature
WRITE_MINIMAL_INTS

Feature that determines whether generator should try to use smallest (size-wise) integer representation: if true, will use smallest representation that is enough to retain value; if false, will use length indicated by argument type (4-byte for int, 8-byte for long and so on).

public static final CBORWriteFeature
WRITE_TYPE_HEADER

Feature that determines whether CBOR "Self-Describe Tag" (value 55799, encoded as 3-byte sequence of 0xD9, 0xD9, 0xF7) should be written at the beginning of document or not.

Constructor Summary

AccessConstructor and Description
private
CBORWriteFeature(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 CBORWriteFeature
public static CBORWriteFeature[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

_defaultStateback to summary
private final boolean _defaultState
_maskback to summary
private final int _mask
ENCODE_USING_STANDARD_NEGATIVE_BIGINT_ENCODINGback to summary
public static final CBORWriteFeature ENCODE_USING_STANDARD_NEGATIVE_BIGINT_ENCODING

Feature that determines how binary tagged negative BigInteger values are encoded: either using CBOR standard encoding logic (as per spec), or using legacy Jackson encoding logic (encoding up to Jackson 2.19). When enabled, uses CBOR standard specified encoding of negative values (e.g., -1 is encoded [0xC3, 0x41, 0x00]). When disabled, maintains behavior of versions prior to 3.0. (e.g., -1 is encoded [0xC3, 0x41, 0x01]) and uses legacy Jackson encoding.

Note that there is the counterpart CBORReadFeature#DECODE_USING_STANDARD_NEGATIVE_BIGINT_ENCODING for encoding.

The default value is true in Jackson 3.x (was false in Jackson 2.x).

LENIENT_UTF_ENCODINGback to summary
public static final CBORWriteFeature LENIENT_UTF_ENCODING

Feature that determines if an invalid surrogate encoding found in the incoming String should fail with an exception or silently be output as the Unicode 'REPLACEMENT CHARACTER' (U+FFFD) or not; if not, an exception will be thrown to indicate invalid content.

Default value is false (for backwards compatibility) meaning that an invalid surrogate will result in exception (StreamWriteException).

STRINGREFback to summary
public static final CBORWriteFeature STRINGREF

Feature that determines if string references are generated based on the stringref) extension. This can save storage space, parsing time, and pool string memory when parsing. Readers of the output must also support the stringref extension to properly decode the data. Extra overhead may be added to generation time and memory usage to compute the shared binary and text strings.

Default value is false meaning that the stringref extension will not be used.

WRITE_MINIMAL_DOUBLESback to summary
public static final CBORWriteFeature WRITE_MINIMAL_DOUBLES

Feature that determines whether generator should try to write doubles as floats: if true, will write a double as a 4-byte float if no precision loss will occur; if false, will always write a double as an 8-byte double.

Default value is false meaning that doubles will always be written as 8-byte values.

WRITE_MINIMAL_INTSback to summary
public static final CBORWriteFeature WRITE_MINIMAL_INTS

Feature that determines whether generator should try to use smallest (size-wise) integer representation: if true, will use smallest representation that is enough to retain value; if false, will use length indicated by argument type (4-byte for int, 8-byte for long and so on).

WRITE_TYPE_HEADERback to summary
public static final CBORWriteFeature WRITE_TYPE_HEADER

Feature that determines whether CBOR "Self-Describe Tag" (value 55799, encoded as 3-byte sequence of 0xD9, 0xD9, 0xF7) should be written at the beginning of document or not.

Default value is false meaning that type tag will not be written at the beginning of a new document.

Constructor Detail

CBORWriteFeatureback to summary
private CBORWriteFeature(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 CBORWriteFeature valueOf(String name)
valuesback to summary
public static CBORWriteFeature[] values()