Enum Class CBORWriteFeature
- All Implemented Interfaces:
Serializable, Comparable<CBORWriteFeature>, Constable, tools.jackson.core.FormatFeature, tools.jackson.core.util.JacksonFeature
public enum CBORWriteFeature
extends Enum<CBORWriteFeature>
implements tools.jackson.core.FormatFeature
Enumeration that defines all togglable features for CBOR generator.
NOTE: in Jackson 2.x this was named CBORGenerator.Feature.
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionFeature 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).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.Feature that determines if string references are generated based on the stringref) extension.Feature that determines whether generator should try to write doubles as floats: iftrue, will write adoubleas a 4-byte float if no precision loss will occur; iffalse, will always write adoubleas an 8-byte double.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 forint, 8-byte forlongand so on).Feature that determines whether CBOR "Self-Describe Tag" (value 55799, encoded as 3-byte sequence of0xD9, 0xD9, 0xF7) should be written at the beginning of document or not. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intMethod that calculates bit set (flags) of all features that are enabled by default.booleanbooleanenabledIn(int flags) intgetMask()static CBORWriteFeatureReturns the enum constant of this class with the specified name.static CBORWriteFeature[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
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 forint, 8-byte forlongand so on).Default value is
truemeaning that minimal representation is used when encoding. -
WRITE_TYPE_HEADER
Feature that determines whether CBOR "Self-Describe Tag" (value 55799, encoded as 3-byte sequence of0xD9, 0xD9, 0xF7) should be written at the beginning of document or not.Default value is
falsemeaning that type tag will not be written at the beginning of a new document. -
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). -
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
falsemeaning that the stringref extension will not be used. -
WRITE_MINIMAL_DOUBLES
Feature that determines whether generator should try to write doubles as floats: iftrue, will write adoubleas a 4-byte float if no precision loss will occur; iffalse, will always write adoubleas an 8-byte double.Default value is
falsemeaning that doubles will always be written as 8-byte values. -
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_ENCODINGfor encoding.The default value is
truein Jackson 3.x (wasfalsein Jackson 2.x).
-
-
Field Details
-
_defaultState
private final boolean _defaultState -
_mask
private final int _mask
-
-
Constructor Details
-
CBORWriteFeature
private CBORWriteFeature(boolean defaultState)
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
collectDefaults
public static int collectDefaults()Method that calculates bit set (flags) of all features that are enabled by default. -
enabledByDefault
public boolean enabledByDefault()- Specified by:
enabledByDefaultin interfacetools.jackson.core.util.JacksonFeature
-
enabledIn
public boolean enabledIn(int flags) - Specified by:
enabledInin interfacetools.jackson.core.util.JacksonFeature
-
getMask
public int getMask()- Specified by:
getMaskin interfacetools.jackson.core.util.JacksonFeature
-