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

public Class SmileFactory

extends BinaryTSFactory
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.*, java.util.List, .Locale, tools.jackson.core.*, tools.jackson.core.base.BinaryTSFactory, tools.jackson.core.exc.StreamWriteException, tools.jackson.core.io.IOContext, tools.jackson.core.sym.BinaryNameMatcher, .ByteQuadsCanonicalizer, .PropertyNameMatcher, tools.jackson.core.util.Named, tools.jackson.dataformat.smile.async.NonBlockingByteArrayParser

Factory used for constructing SmileParser and SmileGenerator instances; both of which handle Smile encoded data.

Extends TokenStreamFactory mostly so that users can actually use it in place of regular non-Smile factory instances.

Note on using non-byte-based sources/targets (char based, like java.io.Reader and java.io.Writer): these can not be used for Smile-format documents, and thus will either downgrade to textual JSON (when parsing), or throw exception (when trying to create generator).

Field Summary

Modifier and TypeField and Description
protected final transient ByteQuadsCanonicalizer
_byteSymbolCanonicalizer

Alternative to the basic symbol table, some stream-based parsers use different name canonicalization method.

pack-priv static final int
DEFAULT_SMILE_GENERATOR_FEATURE_FLAGS

Bitfield (set of flags) of all generator features that are enabled by default.

pack-priv static final int
DEFAULT_SMILE_PARSER_FEATURE_FLAGS

Bitfield (set of flags) of all parser features that are enabled by default.

public static final String
FORMAT_NAME_SMILE

Name used to identify Smile format.

private static final long

Constructor Summary

AccessConstructor and Description
public
SmileFactory()

Default constructor used to create factory instances.

public
protected
SmileFactory(SmileFactoryBuilder b)

Constructors used by SmileFactoryBuilder for instantiation.

Method Summary

Modifier and TypeMethod and Description
protected JsonGenerator
_createGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, OutputStream out)

Implements abstract tools.jackson.core.base.BinaryTSFactory._createGenerator.

Overridable factory method that actually instantiates generator for given OutputStream and context object, using UTF-8 encoding.

protected JsonParser
_createParser(ObjectReadContext readCtxt, IOContext ioCtxt, InputStream in)

Implements abstract tools.jackson.core.base.BinaryTSFactory._createParser.

Overridable factory method that actually instantiates desired parser.

protected JsonParser
_createParser(ObjectReadContext readCtxt, IOContext ioCtxt, byte[] data, int offset, int len)

Implements abstract tools.jackson.core.base.BinaryTSFactory._createParser.

protected JsonParser
public static SmileFactoryBuilder
builder()

Main factory method to use for constructing SmileFactory instances with different configuration.

public boolean
canParseAsync()

Implements abstract tools.jackson.core.TokenStreamFactory.canParseAsync.

Introspection method that can be used to check whether this factory can create non-blocking parsers: parsers that do not use blocking I/O abstractions but instead use a tools.jackson.core.async.NonBlockingInputFeeder.

public boolean
canUseSchema(FormatSchema schema)

Implements abstract tools.jackson.core.TokenStreamFactory.canUseSchema.

Method that can be used to quickly check whether given schema is something that parsers and/or generators constructed by this factory could use.

public PropertyNameMatcher
constructCINameMatcher(List<Named> matches, boolean alreadyInterned, Locale locale)

Overrides tools.jackson.core.TokenStreamFactory.constructCINameMatcher.

Factory method for constructing case-insensitive PropertyNameMatcher for given names.

public PropertyNameMatcher
constructNameMatcher(List<Named> matches, boolean alreadyInterned)

Overrides tools.jackson.core.TokenStreamFactory.constructNameMatcher.

Factory method for constructing case-sensitive PropertyNameMatcher for given names.

public SmileFactory
copy()

Implements abstract tools.jackson.core.TokenStreamFactory.copy.

Method similar to snapshot(), but one that forces creation of actual new copy that does NOT share any state, even non-visible to calling code, such as symbol table reuse.

public NonBlockingByteArrayParser
createNonBlockingByteArrayParser(ObjectReadContext readCtxt)

Overrides tools.jackson.core.TokenStreamFactory.createNonBlockingByteArrayParser.

Optional method for constructing parser for non-blocking parsing via tools.jackson.core.async.ByteArrayFeeder interface (accessed using JsonParser#nonBlockingInputFeeder() from constructed instance).

public String
getFormatName()

Implements abstract tools.jackson.core.TokenStreamFactory.getFormatName.

Method that returns short textual id identifying format this factory supports.

public Class<SmileReadFeature>
getFormatReadFeatureType()

Overrides tools.jackson.core.TokenStreamFactory.getFormatReadFeatureType.

Method for accessing kind of FormatFeature that a parser JsonParser produced by this factory would accept, if any; null returned if none.

public Class<SmileWriteFeature>
getFormatWriteFeatureType()

Overrides tools.jackson.core.TokenStreamFactory.getFormatWriteFeatureType.

Method for accessing kind of FormatFeature that a parser JsonGenerator produced by this factory would accept, if any; null returned if none.

public final boolean
isEnabled(SmileReadFeature f)

Checked whether specified parser feature is enabled.

public final boolean
isEnabled(SmileWriteFeature f)

Check whether specified generator feature is enabled.

protected Object
readResolve()

Method that we need to override to actually make restoration go through constructors etc.

public SmileFactoryBuilder
rebuild()

Implements abstract tools.jackson.core.TokenStreamFactory.rebuild.

Method that can be used to create differently configured stream factories: it will create and return a Builder instance with exact settings of this stream factory.

public TokenStreamFactory
snapshot()

Implements abstract tools.jackson.core.TokenStreamFactory.snapshot.

Implements tools.jackson.core.util.Snapshottable.snapshot.

Instances are immutable so just return `this`

public Version
version()

Implements abstract tools.jackson.core.TokenStreamFactory.version.

Implements tools.jackson.core.Versioned.version.

Method called to detect version of the component that implements this interface; returned version should never be null, but may return specific "not available" instance (see Version for details).

Inherited from tools.jackson.core.base.BinaryTSFactory:
_createContentReference_createContentReference_nonByteSource_nonByteTargetcanHandleBinaryNativelycreateGeneratorcreateGeneratorcreateGeneratorcreateGeneratorcreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParser

Field Detail

_byteSymbolCanonicalizerback to summary
protected final transient ByteQuadsCanonicalizer _byteSymbolCanonicalizer

Alternative to the basic symbol table, some stream-based parsers use different name canonicalization method.

DEFAULT_SMILE_GENERATOR_FEATURE_FLAGSback to summary
pack-priv static final int DEFAULT_SMILE_GENERATOR_FEATURE_FLAGS

Bitfield (set of flags) of all generator features that are enabled by default.

DEFAULT_SMILE_PARSER_FEATURE_FLAGSback to summary
pack-priv static final int DEFAULT_SMILE_PARSER_FEATURE_FLAGS

Bitfield (set of flags) of all parser features that are enabled by default.

FORMAT_NAME_SMILEback to summary
public static final String FORMAT_NAME_SMILE

Name used to identify Smile format. (and returned by getFormatName()

serialVersionUIDback to summary
private static final long serialVersionUID

Hides tools.jackson.core.base.BinaryTSFactory.serialVersionUID.

Constructor Detail

SmileFactoryback to summary
public SmileFactory()

Default constructor used to create factory instances. Creation of a factory instance is a light-weight operation, but it is still a good idea to reuse limited number of factory instances (and quite often just a single instance): factories are used as context for storing some reused processing objects (such as symbol tables parsers use) and this reuse only works within context of a single factory instance.

SmileFactoryback to summary
public SmileFactory(SmileFactory src)
SmileFactoryback to summary
protected SmileFactory(SmileFactoryBuilder b)

Constructors used by SmileFactoryBuilder for instantiation.

Since
3.0

Method Detail

_createGeneratorback to summary
protected JsonGenerator _createGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, OutputStream out)

Implements abstract tools.jackson.core.base.BinaryTSFactory._createGenerator.

Doc from tools.jackson.core.base.BinaryTSFactory._createGenerator.

Overridable factory method that actually instantiates generator for given OutputStream and context object, using UTF-8 encoding.

This method is specifically designed to remain compatible between minor versions so that sub-classes can count on it being called as expected. That is, it is part of official interface from sub-class perspective, although not a public method available to users of factory implementations.

Annotations
@Override
_createParserback to summary
protected JsonParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, InputStream in)

Implements abstract tools.jackson.core.base.BinaryTSFactory._createParser.

Overridable factory method that actually instantiates desired parser.

Annotations
@Override
_createParserback to summary
protected JsonParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, byte[] data, int offset, int len)

Implements abstract tools.jackson.core.base.BinaryTSFactory._createParser.

Annotations
@Override
_createParserback to summary
protected JsonParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, DataInput input)

Implements abstract tools.jackson.core.base.BinaryTSFactory._createParser.

Annotations
@Override
builderback to summary
public static SmileFactoryBuilder builder()

Main factory method to use for constructing SmileFactory instances with different configuration.

canParseAsyncback to summary
public boolean canParseAsync()

Implements abstract tools.jackson.core.TokenStreamFactory.canParseAsync.

Doc from tools.jackson.core.TokenStreamFactory.canParseAsync.

Introspection method that can be used to check whether this factory can create non-blocking parsers: parsers that do not use blocking I/O abstractions but instead use a tools.jackson.core.async.NonBlockingInputFeeder.

Annotations
@Override
canUseSchemaback to summary
public boolean canUseSchema(FormatSchema schema)

Implements abstract tools.jackson.core.TokenStreamFactory.canUseSchema.

Doc from tools.jackson.core.TokenStreamFactory.canUseSchema.

Method that can be used to quickly check whether given schema is something that parsers and/or generators constructed by this factory could use. Note that this means possible use, at the level of data format (i.e. schema is for same data format as parsers and generators this factory constructs); individual schema instances may have further usage restrictions.

Annotations
@Override
constructCINameMatcherback to summary
public PropertyNameMatcher constructCINameMatcher(List<Named> matches, boolean alreadyInterned, Locale locale)

Overrides tools.jackson.core.TokenStreamFactory.constructCINameMatcher.

Doc from tools.jackson.core.TokenStreamFactory.constructCINameMatcher.

Factory method for constructing case-insensitive PropertyNameMatcher for given names. It will call String#intern on names unless specified that this has already been done by caller.

Annotations
@Override
constructNameMatcherback to summary
public PropertyNameMatcher constructNameMatcher(List<Named> matches, boolean alreadyInterned)

Overrides tools.jackson.core.TokenStreamFactory.constructNameMatcher.

Doc from tools.jackson.core.TokenStreamFactory.constructNameMatcher.

Factory method for constructing case-sensitive PropertyNameMatcher for given names. It will call String#intern on names unless specified that this has already been done by caller.

Annotations
@Override
copyback to summary
public SmileFactory copy()

Implements abstract tools.jackson.core.TokenStreamFactory.copy.

Doc from tools.jackson.core.TokenStreamFactory.copy.

Method similar to snapshot(), but one that forces creation of actual new copy that does NOT share any state, even non-visible to calling code, such as symbol table reuse.

Implementation should be functionally equivalent to:

    factoryInstance.rebuild().build();
Annotations
@Override
createNonBlockingByteArrayParserback to summary
public NonBlockingByteArrayParser createNonBlockingByteArrayParser(ObjectReadContext readCtxt)

Overrides tools.jackson.core.TokenStreamFactory.createNonBlockingByteArrayParser.

Doc from tools.jackson.core.TokenStreamFactory.createNonBlockingByteArrayParser.

Optional method for constructing parser for non-blocking parsing via tools.jackson.core.async.ByteArrayFeeder interface (accessed using JsonParser#nonBlockingInputFeeder() from constructed instance).

If this factory does not support non-blocking parsing (either at all, or from byte array), will throw UnsupportedOperationException.

Note that JSON-backed factory only supports parsing of UTF-8 encoded JSON content (and US-ASCII since it is proper subset); other encodings are not supported at this point.

Annotations
@SuppressWarnings:unchecked
@Override
getFormatNameback to summary
public String getFormatName()

Implements abstract tools.jackson.core.TokenStreamFactory.getFormatName.

Doc from tools.jackson.core.TokenStreamFactory.getFormatName.

Method that returns short textual id identifying format this factory supports.

Annotations
@Override
getFormatReadFeatureTypeback to summary
public Class<SmileReadFeature> getFormatReadFeatureType()

Overrides tools.jackson.core.TokenStreamFactory.getFormatReadFeatureType.

Doc from tools.jackson.core.TokenStreamFactory.getFormatReadFeatureType.

Method for accessing kind of FormatFeature that a parser JsonParser produced by this factory would accept, if any; null returned if none.

Annotations
@Override
getFormatWriteFeatureTypeback to summary
public Class<SmileWriteFeature> getFormatWriteFeatureType()

Overrides tools.jackson.core.TokenStreamFactory.getFormatWriteFeatureType.

Doc from tools.jackson.core.TokenStreamFactory.getFormatWriteFeatureType.

Method for accessing kind of FormatFeature that a parser JsonGenerator produced by this factory would accept, if any; null returned if none.

Annotations
@Override
isEnabledback to summary
public final boolean isEnabled(SmileReadFeature f)

Checked whether specified parser feature is enabled.

isEnabledback to summary
public final boolean isEnabled(SmileWriteFeature f)

Check whether specified generator feature is enabled.

readResolveback to summary
protected Object readResolve()

Method that we need to override to actually make restoration go through constructors etc.

rebuildback to summary
public SmileFactoryBuilder rebuild()

Implements abstract tools.jackson.core.TokenStreamFactory.rebuild.

Doc from tools.jackson.core.TokenStreamFactory.rebuild.

Method that can be used to create differently configured stream factories: it will create and return a Builder instance with exact settings of this stream factory.

Annotations
@Override
snapshotback to summary
public TokenStreamFactory snapshot()

Implements abstract tools.jackson.core.TokenStreamFactory.snapshot.

Implements tools.jackson.core.util.Snapshottable.snapshot.

Instances are immutable so just return `this`

Annotations
@Override
versionback to summary
public Version version()

Implements abstract tools.jackson.core.TokenStreamFactory.version.

Implements tools.jackson.core.Versioned.version.

Doc from tools.jackson.core.Versioned.version.

Method called to detect version of the component that implements this interface; returned version should never be null, but may return specific "not available" instance (see Version for details).

Annotations
@Override