Top Description Fields Constructors Methods
tools.jackson.core

public final Enum StreamReadFeature

extends Enum<StreamReadFeature>
implements JacksonFeature
Class Inheritance
All Implemented Interfaces
tools.jackson.core.util.JacksonFeature
Imports
java.io.InputStream, .Reader, tools.jackson.core.exc.StreamReadException, tools.jackson.core.util.JacksonFeature

Token reader (parser) features not-specific to any particular format backend.

Note

Jackson 2.x contained these along with JSON-specific features in JsonParser.Feature.

Field Summary

Modifier and TypeField and Description
private final boolean
_defaultState

Whether feature is enabled or disabled by default.

private final int
public static final StreamReadFeature
AUTO_CLOSE_SOURCE

Feature that determines whether parser will automatically close underlying input source that is NOT owned by the parser.

public static final StreamReadFeature
CLEAR_CURRENT_TOKEN_ON_CLOSE

Feature that determines whether parser will clear "current token" (accessible via JsonParser#currentToken()) when it is closed (via JsonParser#close()).

public static final StreamReadFeature
IGNORE_UNDEFINED

Feature that determines what to do if the underlying data format requires knowledge of all properties to decode (usually via a Schema), and if no definition is found for a property that input content contains.

public static final StreamReadFeature
INCLUDE_SOURCE_IN_LOCATION

Feature that determines whether TokenStreamLocation instances should be constructed with reference to source or not.

public static final StreamReadFeature
STRICT_DUPLICATE_DETECTION

Feature that determines whether JsonParser will explicitly check that no duplicate JSON Object Property names are encountered.

public static final StreamReadFeature
USE_FAST_BIG_NUMBER_PARSER

Feature that determines whether to use the built-in JDK code for parsing BigDecimal and BigIntegers values (if disabled) or FastDoubleParser implementation (if enabled).

public static final StreamReadFeature
USE_FAST_DOUBLE_PARSER

Feature that determines whether to use the built-in JDK Double#parseDouble(String) code to parse doubles (if disabled) or FastDoubleParser implementation (if enabled).

Constructor Summary

AccessConstructor and Description
private
StreamReadFeature(boolean defaultState)

Method Summary

Modifier and TypeMethod and Description
public static int

Returns:

Bit mask of all features that are enabled by default
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 StreamReadFeature
public static StreamReadFeature[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

_defaultStateback to summary
private final boolean _defaultState

Whether feature is enabled or disabled by default.

_maskback to summary
private final int _mask
AUTO_CLOSE_SOURCEback to summary
public static final StreamReadFeature AUTO_CLOSE_SOURCE

Feature that determines whether parser will automatically close underlying input source that is NOT owned by the parser. If disabled, calling application has to separately close the underlying InputStream and Reader instances used to create the parser. If enabled, parser will handle closing, as long as parser itself gets closed: this happens when end-of-input is encountered, or parser is closed by a call to JsonParser#close.

Feature is enabled by default.

CLEAR_CURRENT_TOKEN_ON_CLOSEback to summary
public static final StreamReadFeature CLEAR_CURRENT_TOKEN_ON_CLOSE

Feature that determines whether parser will clear "current token" (accessible via JsonParser#currentToken()) when it is closed (via JsonParser#close()).

Feature is enabled by default.

IGNORE_UNDEFINEDback to summary
public static final StreamReadFeature IGNORE_UNDEFINED

Feature that determines what to do if the underlying data format requires knowledge of all properties to decode (usually via a Schema), and if no definition is found for a property that input content contains. Typically most textual data formats do NOT require schema information (although some do, such as CSV), whereas many binary data formats do require definitions (such as Avro, protobuf), although not all (Smile, CBOR, BSON and MessagePack do not). Further note that some formats that do require schema information will not be able to ignore undefined properties: for example, Avro is fully positional and there is no possibility of undefined data. This leaves formats like Protobuf that have identifiers that may or may not map; and as such Protobuf format does make use of this feature.

Note that support for this feature is implemented by individual data format module, if (and only if) it makes sense for the format in question. For JSON, for example, this feature has no effect as properties need not be pre-defined.

Feature is disabled by default, meaning that if the underlying data format requires knowledge of all properties to output, attempts to read an unknown property will result in an exception (typically of type tools.jackson.core.exc.StreamReadException).

INCLUDE_SOURCE_IN_LOCATIONback to summary
public static final StreamReadFeature INCLUDE_SOURCE_IN_LOCATION

Feature that determines whether TokenStreamLocation instances should be constructed with reference to source or not. If source reference is included, its type and contents are included when `toString()` method is called (most notably when printing out parse exception with that location information). If feature is disabled, no source reference is passed and source is only indicated as "REDACTED".

Most common reason for disabling this feature is to avoid leaking internal information; this may be done for security reasons. Note that even if source reference is included, only parts of contents are usually printed, and not the whole contents. Further, many source reference types cannot necessarily access contents (like streams), so only type is indicated, not contents.

Feature is disabled by default for security reason (to avoid leaking additional source information), meaning that "source reference" information is NOT passed and none of source content will be included in TokenStreamLocation constructed either when requested explicitly, or when needed for an exception.

STRICT_DUPLICATE_DETECTIONback to summary
public static final StreamReadFeature STRICT_DUPLICATE_DETECTION

Feature that determines whether JsonParser will explicitly check that no duplicate JSON Object Property names are encountered. If enabled, parser will check all names within context and report duplicates by throwing a StreamReadException; if disabled, parser will not do such checking. Assumption in latter case is that caller takes care of handling duplicates at a higher level: data-binding, for example, has features to specify detection to be done there.

Note that enabling this feature will incur performance overhead due to having to store and check additional information: this typically adds 20-30% to execution time for basic parsing.

USE_FAST_BIG_NUMBER_PARSERback to summary
public static final StreamReadFeature USE_FAST_BIG_NUMBER_PARSER

Feature that determines whether to use the built-in JDK code for parsing BigDecimal and BigIntegers values (if disabled) or FastDoubleParser implementation (if enabled).

This setting is enabled by default (since 3.0) so that FastDoubleParser implementation is used.

USE_FAST_DOUBLE_PARSERback to summary
public static final StreamReadFeature USE_FAST_DOUBLE_PARSER

Feature that determines whether to use the built-in JDK Double#parseDouble(String) code to parse doubles (if disabled) or FastDoubleParser implementation (if enabled).

This setting is enabled by default (since 3.0) so that FastDoubleParser implementation is used.

Constructor Detail

StreamReadFeatureback to summary
private StreamReadFeature(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.

Returns:int

Bit mask 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 StreamReadFeature valueOf(String name)
valuesback to summary
public static StreamReadFeature[] values()