Class CBORFactory

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

public class CBORFactory extends tools.jackson.core.base.BinaryTSFactory implements Serializable
Factory used for constructing CBORParser and CBORGenerator instances; both of which handle CBOR encoded data.

Note on using non-byte-based sources/targets (char based, like Reader and Writer): these can not be used for CBOR documents; attempt will throw exception.

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 generator features that are enabled by default.
    static final String
    Name used to identify CBOR 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 CBORFactoryBuilder for instantiation.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected tools.jackson.core.io.IOContext
    _createContext(tools.jackson.core.io.ContentReference contentRef, boolean resourceManaged)
     
    protected tools.jackson.core.JsonGenerator
    _createGenerator(tools.jackson.core.ObjectWriteContext writeCtxt, tools.jackson.core.io.IOContext ioCtxt, OutputStream out)
     
    protected CBORParser
    _createParser(tools.jackson.core.ObjectReadContext readCtxt, tools.jackson.core.io.IOContext ioCtxt, byte[] data, int offset, int len)
    Overridable factory method that actually instantiates desired parser.
    protected tools.jackson.core.JsonParser
    _createParser(tools.jackson.core.ObjectReadContext readCtxt, tools.jackson.core.io.IOContext ctxt, DataInput input)
     
    protected CBORParser
    _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 CBORFactory 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)
     
     
     
     
     
    boolean
    Check whether specified CBOR-specific stream read feature is enabled.
    boolean
    Check whether specified CBOR-specific stream write 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, _createDataOutputWrapper, _fileInputStream, _fileOutputStream, _getBufferRecycler, _getRecyclerPool, _optimizedStreamFromURL, _pathInputStream, _pathOutputStream, _reportRangeError, _unsupported, _unsupported, _wrapIOFailure, createGenerator, createGenerator, createGenerator, createGenerator, createGenerator, createNonBlockingByteArrayParser, 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

      public static final String FORMAT_NAME
      Name used to identify CBOR format. (and returned by getFormatName()
      See Also:
    • DEFAULT_CBOR_GENERATOR_FEATURE_FLAGS

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

      static final int DEFAULT_CBOR_PARSER_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

    • CBORFactory

      public CBORFactory()
      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.
    • CBORFactory

      public CBORFactory(CBORFactory src)
    • CBORFactory

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

    • rebuild

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

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

      public CBORFactory 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. Also: must be overridden by sub-classes as well.
    • 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
    • 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<CBORReadFeature> getFormatReadFeatureType()
      Overrides:
      getFormatReadFeatureType in class tools.jackson.core.TokenStreamFactory
    • getFormatWriteFeatureType

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

      public boolean isEnabled(CBORReadFeature f)
      Check whether specified CBOR-specific stream read feature is enabled.
    • isEnabled

      public boolean isEnabled(CBORWriteFeature f)
      Check whether specified CBOR-specific stream write feature is enabled.
    • _createContext

      protected tools.jackson.core.io.IOContext _createContext(tools.jackson.core.io.ContentReference contentRef, boolean resourceManaged)
      Overrides:
      _createContext in class tools.jackson.core.TokenStreamFactory
    • _createParser

      protected CBORParser _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 CBORParser _createParser(tools.jackson.core.ObjectReadContext readCtxt, tools.jackson.core.io.IOContext ioCtxt, byte[] data, int offset, int len)
      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 ctxt, 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