public class SmileFactory
extends com.fasterxml.jackson.core.JsonFactory
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
Reader
and 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).
Modifier and Type | Field and Description |
---|---|
protected boolean |
_cfgDelegateToTextual
Whether non-supported methods (ones trying to output using
char-based targets like
Writer , for example)
should be delegated to regular Jackson JSON processing
(if set to true); or throw UnsupportedOperationException
(if set to false) |
protected int |
_smileGeneratorFeatures |
protected int |
_smileParserFeatures |
static String |
FORMAT_NAME_SMILE
Name used to identify Smile format.
|
_byteSymbolCanonicalizer, _characterEscapes, _factoryFeatures, _generatorFeatures, _inputDecorator, _objectCodec, _outputDecorator, _parserFeatures, _recyclerRef, _rootCharSymbols, _rootValueSeparator, DEFAULT_FACTORY_FEATURE_FLAGS, DEFAULT_GENERATOR_FEATURE_FLAGS, DEFAULT_PARSER_FEATURE_FLAGS, FORMAT_NAME_JSON
Constructor and Description |
---|
SmileFactory()
Default constructor used to create factory instances.
|
SmileFactory(com.fasterxml.jackson.core.ObjectCodec oc) |
SmileFactory(SmileFactory src,
com.fasterxml.jackson.core.ObjectCodec oc)
Note: REQUIRES 2.2.1 -- unfortunate intra-patch dep but seems
preferable to just leaving bug be as is
|
Modifier and Type | Method and Description |
---|---|
protected SmileGenerator |
_createGenerator(OutputStream out,
com.fasterxml.jackson.core.io.IOContext ctxt) |
protected com.fasterxml.jackson.core.JsonGenerator |
_createGenerator(Writer out,
com.fasterxml.jackson.core.io.IOContext ctxt) |
protected SmileParser |
_createParser(byte[] data,
int offset,
int len,
com.fasterxml.jackson.core.io.IOContext ctxt) |
protected com.fasterxml.jackson.core.JsonParser |
_createParser(char[] data,
int offset,
int len,
com.fasterxml.jackson.core.io.IOContext ctxt,
boolean recyclable) |
protected SmileParser |
_createParser(InputStream in,
com.fasterxml.jackson.core.io.IOContext ctxt)
Overridable factory method that actually instantiates desired parser.
|
protected com.fasterxml.jackson.core.JsonParser |
_createParser(Reader r,
com.fasterxml.jackson.core.io.IOContext ctxt) |
protected com.fasterxml.jackson.core.JsonGenerator |
_createUTF8Generator(OutputStream out,
com.fasterxml.jackson.core.io.IOContext ctxt) |
protected Writer |
_createWriter(OutputStream out,
com.fasterxml.jackson.core.JsonEncoding enc,
com.fasterxml.jackson.core.io.IOContext ctxt) |
protected <T> T |
_nonByteSource() |
protected <T> T |
_nonByteTarget() |
boolean |
canHandleBinaryNatively() |
boolean |
canParseAsync() |
boolean |
canUseCharArrays() |
SmileFactory |
configure(SmileGenerator.Feature f,
boolean state)
Method for enabling or disabling specified generator feature
(check
SmileGenerator.Feature for list of features) |
SmileFactory |
configure(SmileParser.Feature f,
boolean state)
Method for enabling or disabling specified parser feature
(check
SmileParser.Feature for list of features) |
SmileFactory |
copy() |
SmileGenerator |
createGenerator(OutputStream out)
Method for constructing
JsonGenerator for generating
Smile-encoded output. |
SmileGenerator |
createGenerator(OutputStream out,
com.fasterxml.jackson.core.JsonEncoding enc)
Method for constructing
JsonGenerator for generating
Smile-encoded output. |
NonBlockingByteArrayParser |
createNonBlockingByteArrayParser() |
SmileParser |
createParser(byte[] data) |
SmileParser |
createParser(byte[] data,
int offset,
int len) |
SmileParser |
createParser(File f) |
SmileParser |
createParser(InputStream in) |
SmileParser |
createParser(URL url) |
void |
delegateToTextual(boolean state) |
SmileFactory |
disable(SmileGenerator.Feature f)
Method for disabling specified generator feature
(check
SmileGenerator.Feature for list of features) |
SmileFactory |
disable(SmileParser.Feature f)
Method for disabling specified parser features
(check
SmileParser.Feature for list of features) |
SmileFactory |
enable(SmileGenerator.Feature f)
Method for enabling specified generator features
(check
SmileGenerator.Feature for list of features) |
SmileFactory |
enable(SmileParser.Feature f)
Method for enabling specified parser feature
(check
SmileParser.Feature for list of features) |
String |
getFormatName() |
Class<SmileParser.Feature> |
getFormatReadFeatureType() |
Class<SmileGenerator.Feature> |
getFormatWriteFeatureType() |
com.fasterxml.jackson.core.format.MatchStrength |
hasFormat(com.fasterxml.jackson.core.format.InputAccessor acc)
Sub-classes need to override this method (as of 1.8)
|
boolean |
isEnabled(SmileGenerator.Feature f)
Check whether specified generator feature is enabled.
|
boolean |
isEnabled(SmileParser.Feature f)
Checked whether specified parser feature is enabled.
|
protected Object |
readResolve()
Method that we need to override to actually make restoration go
through constructors etc.
|
com.fasterxml.jackson.core.Version |
version() |
_checkInvalidCopy, _createContext, _createDataOutputWrapper, _createParser, _decorate, _decorate, _decorate, _decorate, _decorate, _getBufferRecycler, _optimizedStreamFromURL, canUseSchema, configure, configure, configure, createGenerator, createGenerator, createGenerator, createGenerator, createJsonGenerator, createJsonGenerator, createJsonGenerator, createJsonParser, createJsonParser, createJsonParser, createJsonParser, createJsonParser, createJsonParser, createJsonParser, createParser, createParser, createParser, createParser, createParser, disable, disable, disable, enable, enable, enable, getCharacterEscapes, getCodec, getInputDecorator, getOutputDecorator, getRootValueSeparator, hasJSONFormat, isEnabled, isEnabled, isEnabled, requiresCustomCodec, requiresPropertyOrdering, setCharacterEscapes, setCodec, setInputDecorator, setOutputDecorator, setRootValueSeparator
public static final String FORMAT_NAME_SMILE
getFormatName()
protected boolean _cfgDelegateToTextual
Writer
, for example)
should be delegated to regular Jackson JSON processing
(if set to true); or throw UnsupportedOperationException
(if set to false)protected int _smileParserFeatures
protected int _smileGeneratorFeatures
public SmileFactory()
public SmileFactory(com.fasterxml.jackson.core.ObjectCodec oc)
public SmileFactory(SmileFactory src, com.fasterxml.jackson.core.ObjectCodec oc)
public SmileFactory copy()
copy
in class com.fasterxml.jackson.core.JsonFactory
public void delegateToTextual(boolean state)
protected Object readResolve()
readResolve
in class com.fasterxml.jackson.core.JsonFactory
public com.fasterxml.jackson.core.Version version()
version
in interface com.fasterxml.jackson.core.Versioned
version
in class com.fasterxml.jackson.core.JsonFactory
public String getFormatName()
getFormatName
in class com.fasterxml.jackson.core.JsonFactory
public com.fasterxml.jackson.core.format.MatchStrength hasFormat(com.fasterxml.jackson.core.format.InputAccessor acc) throws IOException
hasFormat
in class com.fasterxml.jackson.core.JsonFactory
IOException
public boolean canUseCharArrays()
canUseCharArrays
in class com.fasterxml.jackson.core.JsonFactory
public boolean canHandleBinaryNatively()
canHandleBinaryNatively
in class com.fasterxml.jackson.core.JsonFactory
public boolean canParseAsync()
canParseAsync
in class com.fasterxml.jackson.core.JsonFactory
public Class<SmileParser.Feature> getFormatReadFeatureType()
getFormatReadFeatureType
in class com.fasterxml.jackson.core.JsonFactory
public Class<SmileGenerator.Feature> getFormatWriteFeatureType()
getFormatWriteFeatureType
in class com.fasterxml.jackson.core.JsonFactory
public final SmileFactory configure(SmileParser.Feature f, boolean state)
SmileParser.Feature
for list of features)public SmileFactory enable(SmileParser.Feature f)
SmileParser.Feature
for list of features)public SmileFactory disable(SmileParser.Feature f)
SmileParser.Feature
for list of features)public final boolean isEnabled(SmileParser.Feature f)
public final SmileFactory configure(SmileGenerator.Feature f, boolean state)
SmileGenerator.Feature
for list of features)public SmileFactory enable(SmileGenerator.Feature f)
SmileGenerator.Feature
for list of features)public SmileFactory disable(SmileGenerator.Feature f)
SmileGenerator.Feature
for list of features)public final boolean isEnabled(SmileGenerator.Feature f)
public SmileParser createParser(File f) throws IOException
createParser
in class com.fasterxml.jackson.core.JsonFactory
IOException
public SmileParser createParser(URL url) throws IOException
createParser
in class com.fasterxml.jackson.core.JsonFactory
IOException
public SmileParser createParser(InputStream in) throws IOException
createParser
in class com.fasterxml.jackson.core.JsonFactory
IOException
public SmileParser createParser(byte[] data) throws IOException
createParser
in class com.fasterxml.jackson.core.JsonFactory
IOException
public SmileParser createParser(byte[] data, int offset, int len) throws IOException
createParser
in class com.fasterxml.jackson.core.JsonFactory
IOException
public SmileGenerator createGenerator(OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc) throws IOException
JsonGenerator
for generating
Smile-encoded output.
Since Smile format always uses UTF-8 internally, enc
argument is ignored.
createGenerator
in class com.fasterxml.jackson.core.JsonFactory
IOException
public SmileGenerator createGenerator(OutputStream out) throws IOException
JsonGenerator
for generating
Smile-encoded output.
Since Smile format always uses UTF-8 internally, no encoding need to be passed to this method.
createGenerator
in class com.fasterxml.jackson.core.JsonFactory
IOException
public NonBlockingByteArrayParser createNonBlockingByteArrayParser() throws IOException
createNonBlockingByteArrayParser
in class com.fasterxml.jackson.core.JsonFactory
IOException
protected SmileParser _createParser(InputStream in, com.fasterxml.jackson.core.io.IOContext ctxt) throws IOException
_createParser
in class com.fasterxml.jackson.core.JsonFactory
IOException
protected com.fasterxml.jackson.core.JsonParser _createParser(Reader r, com.fasterxml.jackson.core.io.IOContext ctxt) throws IOException
_createParser
in class com.fasterxml.jackson.core.JsonFactory
IOException
protected com.fasterxml.jackson.core.JsonParser _createParser(char[] data, int offset, int len, com.fasterxml.jackson.core.io.IOContext ctxt, boolean recyclable) throws IOException
_createParser
in class com.fasterxml.jackson.core.JsonFactory
IOException
protected SmileParser _createParser(byte[] data, int offset, int len, com.fasterxml.jackson.core.io.IOContext ctxt) throws IOException
_createParser
in class com.fasterxml.jackson.core.JsonFactory
IOException
protected com.fasterxml.jackson.core.JsonGenerator _createGenerator(Writer out, com.fasterxml.jackson.core.io.IOContext ctxt) throws IOException
_createGenerator
in class com.fasterxml.jackson.core.JsonFactory
IOException
protected com.fasterxml.jackson.core.JsonGenerator _createUTF8Generator(OutputStream out, com.fasterxml.jackson.core.io.IOContext ctxt) throws IOException
_createUTF8Generator
in class com.fasterxml.jackson.core.JsonFactory
IOException
protected Writer _createWriter(OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc, com.fasterxml.jackson.core.io.IOContext ctxt) throws IOException
_createWriter
in class com.fasterxml.jackson.core.JsonFactory
IOException
protected <T> T _nonByteSource() throws IOException
IOException
protected <T> T _nonByteTarget() throws IOException
IOException
protected SmileGenerator _createGenerator(OutputStream out, com.fasterxml.jackson.core.io.IOContext ctxt) throws IOException
IOException
Copyright © 2017 FasterXML. All rights reserved.