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 |
(package private) static int |
DEFAULT_SMILE_GENERATOR_FEATURE_FLAGS
Bitfield (set of flags) of all generator features that are enabled
by default.
|
(package private) static int |
DEFAULT_SMILE_PARSER_FEATURE_FLAGS
Bitfield (set of flags) of all parser features that are enabled
by default.
|
static java.lang.String |
FORMAT_NAME_SMILE
Name used to identify Smile format.
|
private static long |
serialVersionUID |
_byteSymbolCanonicalizer, _characterEscapes, _factoryFeatures, _generatorFeatures, _inputDecorator, _objectCodec, _outputDecorator, _parserFeatures, _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(java.io.OutputStream out,
com.fasterxml.jackson.core.io.IOContext ctxt) |
protected com.fasterxml.jackson.core.JsonGenerator |
_createGenerator(java.io.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(java.io.InputStream in,
com.fasterxml.jackson.core.io.IOContext ctxt)
Overridable factory method that actually instantiates desired parser.
|
protected com.fasterxml.jackson.core.JsonParser |
_createParser(java.io.Reader r,
com.fasterxml.jackson.core.io.IOContext ctxt) |
protected com.fasterxml.jackson.core.JsonGenerator |
_createUTF8Generator(java.io.OutputStream out,
com.fasterxml.jackson.core.io.IOContext ctxt) |
protected java.io.Writer |
_createWriter(java.io.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(java.io.OutputStream out)
Method for constructing
JsonGenerator for generating
Smile-encoded output. |
SmileGenerator |
createGenerator(java.io.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(java.io.File f) |
SmileParser |
createParser(java.io.InputStream in) |
SmileParser |
createParser(java.net.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) |
java.lang.String |
getFormatName() |
java.lang.Class<SmileParser.Feature> |
getFormatReadFeatureType() |
java.lang.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 java.lang.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, _createNonBlockingContext, _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
private static final long serialVersionUID
public static final java.lang.String FORMAT_NAME_SMILE
getFormatName()
static final int DEFAULT_SMILE_PARSER_FEATURE_FLAGS
static final int DEFAULT_SMILE_GENERATOR_FEATURE_FLAGS
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 java.lang.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 java.lang.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 java.io.IOException
hasFormat
in class com.fasterxml.jackson.core.JsonFactory
java.io.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 java.lang.Class<SmileParser.Feature> getFormatReadFeatureType()
getFormatReadFeatureType
in class com.fasterxml.jackson.core.JsonFactory
public java.lang.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(java.io.File f) throws java.io.IOException
createParser
in class com.fasterxml.jackson.core.JsonFactory
java.io.IOException
public SmileParser createParser(java.net.URL url) throws java.io.IOException
createParser
in class com.fasterxml.jackson.core.JsonFactory
java.io.IOException
public SmileParser createParser(java.io.InputStream in) throws java.io.IOException
createParser
in class com.fasterxml.jackson.core.JsonFactory
java.io.IOException
public SmileParser createParser(byte[] data) throws java.io.IOException
createParser
in class com.fasterxml.jackson.core.JsonFactory
java.io.IOException
public SmileParser createParser(byte[] data, int offset, int len) throws java.io.IOException
createParser
in class com.fasterxml.jackson.core.JsonFactory
java.io.IOException
public SmileGenerator createGenerator(java.io.OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc) throws java.io.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
java.io.IOException
public SmileGenerator createGenerator(java.io.OutputStream out) throws java.io.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
java.io.IOException
public NonBlockingByteArrayParser createNonBlockingByteArrayParser() throws java.io.IOException
createNonBlockingByteArrayParser
in class com.fasterxml.jackson.core.JsonFactory
java.io.IOException
protected SmileParser _createParser(java.io.InputStream in, com.fasterxml.jackson.core.io.IOContext ctxt) throws java.io.IOException
_createParser
in class com.fasterxml.jackson.core.JsonFactory
java.io.IOException
protected com.fasterxml.jackson.core.JsonParser _createParser(java.io.Reader r, com.fasterxml.jackson.core.io.IOContext ctxt) throws java.io.IOException
_createParser
in class com.fasterxml.jackson.core.JsonFactory
java.io.IOException
protected com.fasterxml.jackson.core.JsonParser _createParser(char[] data, int offset, int len, com.fasterxml.jackson.core.io.IOContext ctxt, boolean recyclable) throws java.io.IOException
_createParser
in class com.fasterxml.jackson.core.JsonFactory
java.io.IOException
protected SmileParser _createParser(byte[] data, int offset, int len, com.fasterxml.jackson.core.io.IOContext ctxt) throws java.io.IOException
_createParser
in class com.fasterxml.jackson.core.JsonFactory
java.io.IOException
protected com.fasterxml.jackson.core.JsonGenerator _createGenerator(java.io.Writer out, com.fasterxml.jackson.core.io.IOContext ctxt) throws java.io.IOException
_createGenerator
in class com.fasterxml.jackson.core.JsonFactory
java.io.IOException
protected com.fasterxml.jackson.core.JsonGenerator _createUTF8Generator(java.io.OutputStream out, com.fasterxml.jackson.core.io.IOContext ctxt) throws java.io.IOException
_createUTF8Generator
in class com.fasterxml.jackson.core.JsonFactory
java.io.IOException
protected java.io.Writer _createWriter(java.io.OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc, com.fasterxml.jackson.core.io.IOContext ctxt) throws java.io.IOException
_createWriter
in class com.fasterxml.jackson.core.JsonFactory
java.io.IOException
protected <T> T _nonByteSource() throws java.io.IOException
java.io.IOException
protected <T> T _nonByteTarget() throws java.io.IOException
java.io.IOException
protected SmileGenerator _createGenerator(java.io.OutputStream out, com.fasterxml.jackson.core.io.IOContext ctxt) throws java.io.IOException
java.io.IOException