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

public final Enum SmileWriteFeature

extends Enum<SmileWriteFeature>
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 Smile generators.

Note

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

Field Summary

Modifier and TypeField and Description
private final boolean
private final int
public static final SmileWriteFeature
CHECK_SHARED_NAMES

Whether generator should check if it can "share" property names during generating content or not.

public static final SmileWriteFeature
CHECK_SHARED_STRING_VALUES

Whether generator should check if it can "share" short (at most 64 bytes encoded) String value during generating content or not.

public static final SmileWriteFeature
ENCODE_BINARY_AS_7BIT

Whether to use simple 7-bit per byte encoding for binary content when output.

public static final SmileWriteFeature
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 SmileWriteFeature
WRITE_END_MARKER

Whether write byte marker that signifies end of logical content segment (SmileConstants#BYTE_MARKER_END_OF_CONTENT) when SmileParser#close is called or not.

public static final SmileWriteFeature
WRITE_HEADER

Whether to write 4-byte header sequence when starting output or not.

Constructor Summary

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

Field Detail

_defaultStateback to summary
private final boolean _defaultState
_maskback to summary
private final int _mask
CHECK_SHARED_NAMESback to summary
public static final SmileWriteFeature CHECK_SHARED_NAMES

Whether generator should check if it can "share" property names during generating content or not. If enabled, can replace repeating property names with back references, which are more compact and should faster to decode. Downside is that there is some overhead for writing (need to track existing values, check), as well as decoding.

Since property names tend to repeat quite often, this setting is enabled by default.

CHECK_SHARED_STRING_VALUESback to summary
public static final SmileWriteFeature CHECK_SHARED_STRING_VALUES

Whether generator should check if it can "share" short (at most 64 bytes encoded) String value during generating content or not. If enabled, can replace repeating Short String values with back references, which are more compact and should faster to decode. Downside is that there is some overhead for writing (need to track existing values, check), as well as decoding.

Since efficiency of this option depends a lot on type of content being produced, this option is disabled by default, and should only be enabled if it is likely that same values repeat relatively often.

ENCODE_BINARY_AS_7BITback to summary
public static final SmileWriteFeature ENCODE_BINARY_AS_7BIT

Whether to use simple 7-bit per byte encoding for binary content when output. This is necessary ensure that byte 0xFF will never be included in content output. For other data types this limitation is handled automatically. This setting is enabled by default, however, overhead for binary data (14% size expansion, processing overhead) is non-negligible. If no binary data is output, feature has no effect.

Default setting is true, indicating that binary data is quoted as 7-bit bytes instead of written raw.

LENIENT_UTF_ENCODINGback to summary
public static final SmileWriteFeature 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).

Since
2.13
WRITE_END_MARKERback to summary
public static final SmileWriteFeature WRITE_END_MARKER

Whether write byte marker that signifies end of logical content segment (SmileConstants#BYTE_MARKER_END_OF_CONTENT) when SmileParser#close is called or not. This can be useful when outputting multiple adjacent logical content segments (documents) into single physical output unit (file).

Default setting is false meaning that such marker is not written.

WRITE_HEADERback to summary
public static final SmileWriteFeature WRITE_HEADER

Whether to write 4-byte header sequence when starting output or not. If disabled, no header is written; this may be useful in embedded cases where context is enough to know that content is encoded using this format. Note, however, that omitting header means that default settings for shared names/string values can not be changed.

Default setting is true, meaning that header will be written.

Constructor Detail

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