public static enum CBORGenerator.Feature extends Enum<CBORGenerator.Feature> implements com.fasterxml.jackson.core.FormatFeature
| Enum Constant and Description |
|---|
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).
|
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.
|
STRINGREF
Feature that determines if string references are generated based on the
stringref) extension.
|
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. |
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_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. |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
_defaultState |
protected int |
_mask |
| Modifier and Type | Method and Description |
|---|---|
static int |
collectDefaults()
Method that calculates bit set (flags) of all features that are
enabled by default.
|
boolean |
enabledByDefault() |
boolean |
enabledIn(int flags) |
int |
getMask() |
static CBORGenerator.Feature |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static CBORGenerator.Feature[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final CBORGenerator.Feature WRITE_MINIMAL_INTS
int,
8-byte for long and so on).public static final CBORGenerator.Feature WRITE_TYPE_HEADER
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.
public static final CBORGenerator.Feature LENIENT_UTF_ENCODING
Default value is false (for backwards compatibility) meaning that
an invalid surrogate will result in exception (IllegalArgumentException
public static final CBORGenerator.Feature STRINGREF
Default value is false meaning that the stringref extension will not be used.
public static final CBORGenerator.Feature WRITE_MINIMAL_DOUBLES
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.
public static final CBORGenerator.Feature ENCODE_USING_STANDARD_NEGATIVE_BIGINT_ENCODING
[0xC3, 0x41, 0x00]).
When disabled, maintains backwards compatibility with existing implementations
(e.g., -1 is encoded [0xC3, 0x41, 0x01]) and uses legacy Jackson encoding.
Note that there is the counterpart
CBORParser.Feature.DECODE_USING_STANDARD_NEGATIVE_BIGINT_ENCODING
for encoding.
Default value is false for backwards-compatibility.
public static CBORGenerator.Feature[] values()
for (CBORGenerator.Feature c : CBORGenerator.Feature.values()) System.out.println(c);
public static CBORGenerator.Feature valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static int collectDefaults()
public boolean enabledByDefault()
enabledByDefault in interface com.fasterxml.jackson.core.FormatFeatureenabledByDefault in interface com.fasterxml.jackson.core.util.JacksonFeaturepublic boolean enabledIn(int flags)
enabledIn in interface com.fasterxml.jackson.core.FormatFeatureenabledIn in interface com.fasterxml.jackson.core.util.JacksonFeaturepublic int getMask()
getMask in interface com.fasterxml.jackson.core.FormatFeaturegetMask in interface com.fasterxml.jackson.core.util.JacksonFeatureCopyright © 2026 FasterXML. All rights reserved.