Class SmileFactory

java.lang.Object
tools.jackson.core.TokenStreamFactory
tools.jackson.core.base.DecorableTSFactory
tools.jackson.core.base.BinaryTSFactory
tools.jackson.dataformat.smile.SmileFactory
All Implemented Interfaces:
Serializable, tools.jackson.core.util.Snapshottable<tools.jackson.core.TokenStreamFactory>, tools.jackson.core.Versioned

public class SmileFactory extends tools.jackson.core.base.BinaryTSFactory implements Serializable
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 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).

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class tools.jackson.core.base.DecorableTSFactory

    tools.jackson.core.base.DecorableTSFactory.DecorableTSFBuilder<F,T>

    Nested classes/interfaces inherited from class tools.jackson.core.TokenStreamFactory

    tools.jackson.core.TokenStreamFactory.Feature
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final tools.jackson.core.sym.ByteQuadsCanonicalizer
    Alternative to the basic symbol table, some stream-based parsers use different name canonicalization method.
    (package private) static final int
    Bitfield (set of flags) of all generator features that are enabled by default.
    (package private) static final int
    Bitfield (set of flags) of all parser features that are enabled by default.
    static final String
    Name used to identify Smile format.
    private static final long
     

    Fields inherited from class tools.jackson.core.base.DecorableTSFactory

    _generatorDecorators, _inputDecorator, _outputDecorator

    Fields inherited from class tools.jackson.core.TokenStreamFactory

    _errorReportConfiguration, _factoryFeatures, _formatReadFeatures, _formatWriteFeatures, _recyclerPool, _streamReadConstraints, _streamReadFeatures, _streamWriteConstraints, _streamWriteFeatures, DEFAULT_FACTORY_FEATURE_FLAGS, DEFAULT_STREAM_READ_FEATURE_FLAGS, DEFAULT_STREAM_WRITE_FEATURE_FLAGS, EMPTY_WRITE_CONTEXT
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
    Default constructor used to create factory instances.
     
     
    protected
    Constructors used by SmileFactoryBuilder for instantiation.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected tools.jackson.core.JsonGenerator
    _createGenerator(tools.jackson.core.ObjectWriteContext writeCtxt, tools.jackson.core.io.IOContext ioCtxt, OutputStream out)
     
    protected tools.jackson.core.JsonParser
    _createParser(tools.jackson.core.ObjectReadContext readCtxt, tools.jackson.core.io.IOContext ioCtxt, byte[] data, int offset, int len)
     
    protected tools.jackson.core.JsonParser
    _createParser(tools.jackson.core.ObjectReadContext readCtxt, tools.jackson.core.io.IOContext ioCtxt, DataInput input)
     
    protected tools.jackson.core.JsonParser
    _createParser(tools.jackson.core.ObjectReadContext readCtxt, tools.jackson.core.io.IOContext ioCtxt, InputStream in)
    Overridable factory method that actually instantiates desired parser.
    Main factory method to use for constructing SmileFactory instances with different configuration.
    boolean
     
    boolean
    canUseSchema(tools.jackson.core.FormatSchema schema)
     
    tools.jackson.core.sym.PropertyNameMatcher
    constructCINameMatcher(List<tools.jackson.core.util.Named> matches, boolean alreadyInterned, Locale locale)
     
    tools.jackson.core.sym.PropertyNameMatcher
    constructNameMatcher(List<tools.jackson.core.util.Named> matches, boolean alreadyInterned)
     
     
    createNonBlockingByteArrayParser(tools.jackson.core.ObjectReadContext readCtxt)
     
     
     
     
    final boolean
    Checked whether specified parser feature is enabled.
    final boolean
    Check whether specified generator feature is enabled.
    protected Object
    Method that we need to override to actually make restoration go through constructors etc.
     
    tools.jackson.core.TokenStreamFactory
    Instances are immutable so just return `this`
    tools.jackson.core.Version
     

    Methods inherited from class tools.jackson.core.base.BinaryTSFactory

    _createContentReference, _createContentReference, _nonByteSource, _nonByteTarget, canHandleBinaryNatively, createGenerator, createGenerator, createGenerator, createGenerator, createParser, createParser, createParser, createParser, createParser, createParser, createParser, createParser

    Methods inherited from class tools.jackson.core.base.DecorableTSFactory

    _copy, _decorate, _decorate, _decorate, _decorate, _decorate, _decorate, getGeneratorDecorators, getInputDecorator, getOutputDecorator

    Methods inherited from class tools.jackson.core.TokenStreamFactory

    _checkRangeBoundsForByteArray, _checkRangeBoundsForCharArray, _createContext, _createContext, _createDataOutputWrapper, _fileInputStream, _fileOutputStream, _getBufferRecycler, _getRecyclerPool, _optimizedStreamFromURL, _pathInputStream, _pathOutputStream, _reportRangeError, _unsupported, _unsupported, _wrapIOFailure, createGenerator, createGenerator, createGenerator, createGenerator, createGenerator, createNonBlockingByteBufferParser, createParser, createParser, createParser, createParser, createParser, createParser, createParser, createParser, createParser, createParser, errorReportConfiguration, getFactoryFeatures, getFormatReadFeatures, getFormatWriteFeatures, getStreamReadFeatures, getStreamWriteFeatures, isEnabled, isEnabled, isEnabled, requiresPropertyOrdering, streamReadConstraints, streamWriteConstraints

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • FORMAT_NAME_SMILE

      public static final String FORMAT_NAME_SMILE
      Name used to identify Smile format. (and returned by getFormatName()
      See Also:
    • DEFAULT_SMILE_PARSER_FEATURE_FLAGS

      static final int DEFAULT_SMILE_PARSER_FEATURE_FLAGS
      Bitfield (set of flags) of all parser features that are enabled by default.
    • DEFAULT_SMILE_GENERATOR_FEATURE_FLAGS

      static final int DEFAULT_SMILE_GENERATOR_FEATURE_FLAGS
      Bitfield (set of flags) of all generator features that are enabled by default.
    • _byteSymbolCanonicalizer

      protected final transient tools.jackson.core.sym.ByteQuadsCanonicalizer _byteSymbolCanonicalizer
      Alternative to the basic symbol table, some stream-based parsers use different name canonicalization method.
  • Constructor Details

    • SmileFactory

      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.
    • SmileFactory

      public SmileFactory(SmileFactory src)
    • SmileFactory

      protected SmileFactory(SmileFactoryBuilder b)
      Constructors used by SmileFactoryBuilder for instantiation.
      Since:
      3.0
  • Method Details

    • rebuild

      public SmileFactoryBuilder rebuild()
      Specified by:
      rebuild in class tools.jackson.core.TokenStreamFactory
    • builder

      public static SmileFactoryBuilder builder()
      Main factory method to use for constructing SmileFactory instances with different configuration.
    • copy

      public SmileFactory copy()
      Specified by:
      copy in class tools.jackson.core.TokenStreamFactory
    • snapshot

      public tools.jackson.core.TokenStreamFactory snapshot()
      Instances are immutable so just return `this`
      Specified by:
      snapshot in interface tools.jackson.core.util.Snapshottable<tools.jackson.core.TokenStreamFactory>
      Specified by:
      snapshot in class tools.jackson.core.TokenStreamFactory
    • readResolve

      protected Object readResolve()
      Method that we need to override to actually make restoration go through constructors etc.
    • version

      public tools.jackson.core.Version version()
      Specified by:
      version in interface tools.jackson.core.Versioned
      Specified by:
      version in class tools.jackson.core.TokenStreamFactory
    • canParseAsync

      public boolean canParseAsync()
      Specified by:
      canParseAsync in class tools.jackson.core.TokenStreamFactory
    • isEnabled

      public final boolean isEnabled(SmileReadFeature f)
      Checked whether specified parser feature is enabled.
    • isEnabled

      public final boolean isEnabled(SmileWriteFeature f)
      Check whether specified generator feature is enabled.
    • getFormatName

      public String getFormatName()
      Specified by:
      getFormatName in class tools.jackson.core.TokenStreamFactory
    • canUseSchema

      public boolean canUseSchema(tools.jackson.core.FormatSchema schema)
      Specified by:
      canUseSchema in class tools.jackson.core.TokenStreamFactory
    • getFormatReadFeatureType

      public Class<SmileReadFeature> getFormatReadFeatureType()
      Overrides:
      getFormatReadFeatureType in class tools.jackson.core.TokenStreamFactory
    • getFormatWriteFeatureType

      public Class<SmileWriteFeature> getFormatWriteFeatureType()
      Overrides:
      getFormatWriteFeatureType in class tools.jackson.core.TokenStreamFactory
    • createNonBlockingByteArrayParser

      public NonBlockingByteArrayParser createNonBlockingByteArrayParser(tools.jackson.core.ObjectReadContext readCtxt)
      Overrides:
      createNonBlockingByteArrayParser in class tools.jackson.core.TokenStreamFactory
    • _createParser

      protected tools.jackson.core.JsonParser _createParser(tools.jackson.core.ObjectReadContext readCtxt, tools.jackson.core.io.IOContext ioCtxt, InputStream in)
      Overridable factory method that actually instantiates desired parser.
      Specified by:
      _createParser in class tools.jackson.core.base.BinaryTSFactory
    • _createParser

      protected tools.jackson.core.JsonParser _createParser(tools.jackson.core.ObjectReadContext readCtxt, tools.jackson.core.io.IOContext ioCtxt, byte[] data, int offset, int len)
      Specified by:
      _createParser in class tools.jackson.core.base.BinaryTSFactory
    • _createParser

      protected tools.jackson.core.JsonParser _createParser(tools.jackson.core.ObjectReadContext readCtxt, tools.jackson.core.io.IOContext ioCtxt, DataInput input)
      Specified by:
      _createParser in class tools.jackson.core.base.BinaryTSFactory
    • _createGenerator

      protected tools.jackson.core.JsonGenerator _createGenerator(tools.jackson.core.ObjectWriteContext writeCtxt, tools.jackson.core.io.IOContext ioCtxt, OutputStream out)
      Specified by:
      _createGenerator in class tools.jackson.core.base.BinaryTSFactory
    • constructNameMatcher

      public tools.jackson.core.sym.PropertyNameMatcher constructNameMatcher(List<tools.jackson.core.util.Named> matches, boolean alreadyInterned)
      Overrides:
      constructNameMatcher in class tools.jackson.core.TokenStreamFactory
    • constructCINameMatcher

      public tools.jackson.core.sym.PropertyNameMatcher constructCINameMatcher(List<tools.jackson.core.util.Named> matches, boolean alreadyInterned, Locale locale)
      Overrides:
      constructCINameMatcher in class tools.jackson.core.TokenStreamFactory