Top Description Fields Constructors Methods
com.fasterxml.jackson.dataformat.smile

public Class SmileFactory

extends JsonFactory
Class Inheritance
Imports
java.io.*, java.net.URL, com.fasterxml.jackson.core.*, com.fasterxml.jackson.core.format.InputAccessor, .MatchStrength, com.fasterxml.jackson.core.io.IOContext, com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer, com.fasterxml.jackson.dataformat.smile.async.NonBlockingByteArrayParser

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

Extends JsonFactory 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).

Author
Tatu Saloranta

Field Summary

Modifier and TypeField and Description
protected boolean
_cfgDelegateToTextual

Whether non-supported methods (ones trying to output using char-based targets like java.io.Writer, for example) should be delegated to regular Jackson JSON processing (if set to true); or throw UnsupportedOperationException (if set to false)

protected int
protected int
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
Inherited from com.fasterxml.jackson.core.JsonFactory:
_byteSymbolCanonicalizer_characterEscapes_errorReportConfiguration_factoryFeatures_generatorDecorators_generatorFeatures_inputDecorator_maximumNonEscapedChar_objectCodec_outputDecorator_parserFeatures_quoteChar_recyclerPool_rootCharSymbols_rootValueSeparator_streamReadConstraints_streamWriteConstraintsDEFAULT_FACTORY_FEATURE_FLAGSDEFAULT_GENERATOR_FEATURE_FLAGSDEFAULT_PARSER_FEATURE_FLAGSDEFAULT_QUOTE_CHARDEFAULT_ROOT_VALUE_SEPARATORFORMAT_NAME_JSON

Constructor Summary

AccessConstructor and Description
public
SmileFactory()

Default constructor used to create factory instances.

public
public
SmileFactory(SmileFactory src, ObjectCodec oc)

Note

REQUIRES 2.2.1 -- unfortunate intra-patch dep but seems preferable to just leaving bug be as is

protected
SmileFactory(SmileFactoryBuilder b)

Constructors used by SmileFactoryBuilder for instantiation.

Method Summary

Modifier and TypeMethod and Description
protected JsonGenerator
_createGenerator(Writer
Writer underlying writer to write generated content to
out
,
IOContext
I/O context to use
ctxt
)

Overrides com.fasterxml.jackson.core.JsonFactory._createGenerator.

Overridable factory method that actually instantiates generator for given Writer and context object.

protected SmileGenerator
protected SmileParser
_createParser(InputStream
InputStream to use for reading content to parse
in
,
IOContext
I/O context to use for parsing
ctxt
)

Overrides com.fasterxml.jackson.core.JsonFactory._createParser.

Overridable factory method that actually instantiates desired parser.

protected JsonParser
_createParser(Reader
Reader to use for reading content to parse
r
,
IOContext
I/O context to use for parsing
ctxt
)

Overrides com.fasterxml.jackson.core.JsonFactory._createParser.

Overridable factory method that actually instantiates parser using given Reader object for reading content.

protected JsonParser
_createParser(char[]
Buffer that contains content to parse
data
,
int
Offset to the first character of data to parse
offset
,
int
Number of characters within buffer to parse
len
,
IOContext
I/O context to use for parsing
ctxt
,
boolean
Whether input buffer is recycled by the factory
recyclable
)

Overrides com.fasterxml.jackson.core.JsonFactory._createParser.

Overridable factory method that actually instantiates parser using given char[] object for accessing content.

protected SmileParser
_createParser(byte[]
Buffer that contains content to parse
data
,
int
Offset to the first character of data to parse
offset
,
int
Number of characters within buffer to parse
len
,
IOContext
I/O context to use for parsing
ctxt
)

Overrides com.fasterxml.jackson.core.JsonFactory._createParser.

Overridable factory method that actually instantiates parser using given Reader object for reading content passed as raw byte array.

protected JsonGenerator
_createUTF8Generator(OutputStream
OutputStream underlying writer to write generated content to
out
,
IOContext
I/O context to use
ctxt
)

Overrides com.fasterxml.jackson.core.JsonFactory._createUTF8Generator.

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

protected Writer
protected <T> T
protected <T> T
public static SmileFactoryBuilder
builder()

Hides com.fasterxml.jackson.core.JsonFactory.builder.

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

public boolean
canHandleBinaryNatively()

Overrides com.fasterxml.jackson.core.JsonFactory.canHandleBinaryNatively.

Introspection method that higher-level functionality may call to see whether underlying data format can read and write binary data natively; that is, embeded it as-is without using encodings such as Base64.

public boolean
canParseAsync()

Overrides com.fasterxml.jackson.core.JsonFactory.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 com.fasterxml.jackson.core.async.NonBlockingInputFeeder.

public boolean
canUseCharArrays()

Overrides com.fasterxml.jackson.core.JsonFactory.canUseCharArrays.

Introspection method that can be used by base factory to check whether access using char[] is something that actual parser implementations can take advantage of, over having to use java.io.Reader.

public final SmileFactory
configure(SmileParser.Feature f, boolean state)

Method for enabling or disabling specified parser feature (check SmileParser.Feature for list of features)

public final SmileFactory
configure(SmileGenerator.Feature f, boolean state)

Method for enabling or disabling specified generator feature (check SmileGenerator.Feature for list of features)

public SmileFactory
copy()

Overrides com.fasterxml.jackson.core.JsonFactory.copy.

Method for constructing a new JsonFactory that has the same settings as this instance, but is otherwise independent (i.e. nothing is actually shared, symbol tables are separate).

public SmileGenerator
createGenerator(OutputStream
OutputStream to use for writing JSON content
out
,
JsonEncoding
Character encoding to use
enc
)

Overrides com.fasterxml.jackson.core.JsonFactory.createGenerator.

Method for constructing JsonGenerator for generating Smile-encoded output.

public SmileGenerator
createGenerator(OutputStream out)

Overrides com.fasterxml.jackson.core.JsonFactory.createGenerator.

Method for constructing JsonGenerator for generating Smile-encoded output.

public NonBlockingByteArrayParser
createNonBlockingByteArrayParser()

Overrides com.fasterxml.jackson.core.JsonFactory.createNonBlockingByteArrayParser.

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

public SmileParser
createParser(File
File that contains JSON content to parse
f
)

Overrides com.fasterxml.jackson.core.JsonFactory.createParser.

Method for constructing JSON parser instance to parse contents of specified file.

public SmileParser
createParser(URL
URL pointing to resource that contains JSON content to parse
url
)

Overrides com.fasterxml.jackson.core.JsonFactory.createParser.

Method for constructing JSON parser instance to parse contents of resource reference by given URL.

public SmileParser
createParser(InputStream
InputStream to use for reading JSON content to parse
in
)

Overrides com.fasterxml.jackson.core.JsonFactory.createParser.

Method for constructing JSON parser instance to parse the contents accessed via specified input stream.

public SmileParser
createParser(byte[] data)

Overrides com.fasterxml.jackson.core.JsonFactory.createParser.

Method for constructing parser for parsing the contents of given byte array.

public SmileParser
createParser(byte[]
Buffer that contains data to parse
data
,
int
Offset of the first data byte within buffer
offset
,
int
Length of contents to parse within buffer
len
)

Overrides com.fasterxml.jackson.core.JsonFactory.createParser.

Method for constructing parser for parsing the contents of given byte array.

public void
delegateToTextual(boolean state)

public SmileFactory
disable(SmileParser.Feature f)

Method for disabling specified parser features (check SmileParser.Feature for list of features)

public SmileFactory
disable(SmileGenerator.Feature f)

Method for disabling specified generator feature (check SmileGenerator.Feature for list of features)

public SmileFactory
enable(SmileParser.Feature f)

Method for enabling specified parser feature (check SmileParser.Feature for list of features)

public SmileFactory
enable(SmileGenerator.Feature f)

Method for enabling specified generator features (check SmileGenerator.Feature for list of features)

public int
public String
getFormatName()

Overrides com.fasterxml.jackson.core.JsonFactory.getFormatName.

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

public int
public Class<SmileParser.Feature>
getFormatReadFeatureType()

Overrides com.fasterxml.jackson.core.JsonFactory.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<SmileGenerator.Feature>
getFormatWriteFeatureType()

Overrides com.fasterxml.jackson.core.JsonFactory.getFormatWriteFeatureType.

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

public MatchStrength
hasFormat(InputAccessor acc)

Overrides com.fasterxml.jackson.core.JsonFactory.hasFormat.

Sub-classes need to override this method (as of 1.8)

public final boolean
isEnabled(SmileParser.Feature f)

Checked whether specified parser feature is enabled.

public final boolean
isEnabled(SmileGenerator.Feature f)

Check whether specified generator feature is enabled.

protected Object
readResolve()

Overrides com.fasterxml.jackson.core.JsonFactory.readResolve.

Method that we need to override to actually make restoration go through constructors etc. Also: must be overridden by sub-classes as well.

public SmileFactoryBuilder
rebuild()

Overrides com.fasterxml.jackson.core.JsonFactory.rebuild.

Method that allows construction of differently configured factory, starting with settings of this factory.

public Version
version()

Overrides com.fasterxml.jackson.core.JsonFactory.version.

Implements com.fasterxml.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 com.fasterxml.jackson.core.JsonFactory:
_checkInvalidCopy_copy_createContentReference_createContentReference_createContext_createContext_createNonBlockingContext_createParser_decorate_decorate_decorate_decorate_decorate_decorate_getBufferRecycler_getRecyclerPoolcanUseSchemaconfigureconfigureconfigurecreateGeneratorcreateGeneratorcreateGeneratorcreateGeneratorcreateJsonGeneratorcreateJsonGeneratorcreateJsonGeneratorcreateJsonParsercreateJsonParsercreateJsonParsercreateJsonParsercreateJsonParsercreateJsonParsercreateJsonParsercreateNonBlockingByteBufferParsercreateParsercreateParsercreateParsercreateParsercreateParserdisabledisabledisableenableenableenablegetCharacterEscapesgetCodecgetFactoryFeaturesgetGeneratorFeaturesgetInputDecoratorgetOutputDecoratorgetParserFeaturesgetRootValueSeparatorhasJSONFormatisEnabledisEnabledisEnabledisEnabledisEnabledrequiresCustomCodecrequiresPropertyOrderingsetCharacterEscapessetCodecsetErrorReportConfigurationsetInputDecoratorsetOutputDecoratorsetRecyclerPoolsetRootValueSeparatorsetStreamReadConstraintssetStreamWriteConstraintsstreamReadConstraintsstreamWriteConstraints