JsonFactory
Date: 2016-12-03

com.fasterxml.jackson.core

## Class JsonFactory

- java.lang.Object
- - com.fasterxml.jackson.core.JsonFactory

- All Implemented Interfaces:
    Versioned, java.io.Serializable

      public class JsonFactory
      extends java.lang.Object
      implements Versioned, java.io.Serializable

  The main factory class of Jackson package, used to configure and construct reader (aka parser, `JsonParser`) and writer (aka generator, `JsonGenerator`) instances.

  Factory instances are thread-safe and reusable after configuration (if any). Typically applications and services use only a single globally shared factory instance, unless they need differently configured factories. Factory reuse is important if efficiency matters; most recycling of expensive construct is done on per-factory basis.

  Creation of a factory instance is a light-weight operation, and since there is no need for pluggable alternative implementations (as there is no "standard" JSON processor API to implement), the default constructor is used for constructing factory instances.

  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `JsonFactory.Feature` Enumeration that defines all on/off features that can only be changed for `JsonFactory`.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ByteQuadsCanonicalizer` | `_byteSymbolCanonicalizer` Alternative to the basic symbol table, some stream-based parsers use different name canonicalization method.
    `protected CharacterEscapes` | `_characterEscapes` Definition of custom character escapes to use for generators created by this factory, if any.
    `protected int` | `_factoryFeatures` Currently enabled factory features.
    `protected int` | `_generatorFeatures` Currently enabled generator features.
    `protected InputDecorator` | `_inputDecorator` Optional helper object that may decorate input sources, to do additional processing on input during parsing.
    `protected ObjectCodec` | `_objectCodec` Object that implements conversion functionality between Java objects and JSON content.
    `protected OutputDecorator` | `_outputDecorator` Optional helper object that may decorate output object, to do additional processing on output during content generation.
    `protected int` | `_parserFeatures` Currently enabled parser features.
    `protected static java.lang.ThreadLocal<java.lang.ref.SoftReference<BufferRecycler>>` | `_recyclerRef` This `ThreadLocal` contains a `SoftReference` to a `BufferRecycler` used to provide a low-cost buffer recycling between reader and writer instances.
    `protected CharsToNameCanonicalizer` | `_rootCharSymbols` Each factory comes equipped with a shared root symbol table.
    `protected SerializableString` | `_rootValueSeparator` Separator used between root-level values, if any; null indicates "do not add separator".
    `protected static int` | `DEFAULT_FACTORY_FEATURE_FLAGS` Bitfield (set of flags) of all factory features that are enabled by default.
    `protected static int` | `DEFAULT_GENERATOR_FEATURE_FLAGS` Bitfield (set of flags) of all generator features that are enabled by default.
    `protected static int` | `DEFAULT_PARSER_FEATURE_FLAGS` Bitfield (set of flags) of all parser features that are enabled by default.
    `static java.lang.String` | `FORMAT_NAME_JSON` Name used to identify JSON format (and returned by `getFormatName()`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `JsonFactory()` Default constructor used to create factory instances.
    `protected` | `JsonFactory(JsonFactory src, ObjectCodec codec)` Constructor used when copy()ing a factory instance.
    `` | `JsonFactory(ObjectCodec oc)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `_checkInvalidCopy(java.lang.Class<?> exp)`
    `protected IOContext` | `_createContext(java.lang.Object srcRef, boolean resourceManaged)` Overridable factory method that actually instantiates desired context object.
    `protected java.io.OutputStream` | `_createDataOutputWrapper(java.io.DataOutput out)`
    `protected JsonGenerator` | `_createGenerator(java.io.Writer out, IOContext ctxt)` Overridable factory method that actually instantiates generator for given `Writer` and context object.
    `protected JsonParser` | `_createParser(byte[] data, int offset, int len, IOContext ctxt)` Overridable factory method that actually instantiates parser using given `Reader` object for reading content passed as raw byte array.
    `protected JsonParser` | `_createParser(char[] data, int offset, int len, IOContext ctxt, boolean recyclable)` Overridable factory method that actually instantiates parser using given `char[]` object for accessing content.
    `protected JsonParser` | `_createParser(java.io.DataInput input, IOContext ctxt)`
    `protected JsonParser` | `_createParser(java.io.InputStream in, IOContext ctxt)` Overridable factory method that actually instantiates desired parser given `InputStream` and context object.
    `protected JsonParser` | `_createParser(java.io.Reader r, IOContext ctxt)` Overridable factory method that actually instantiates parser using given `Reader` object for reading content.
    `protected JsonGenerator` | `_createUTF8Generator(java.io.OutputStream out, IOContext ctxt)` Overridable factory method that actually instantiates generator for given `OutputStream` and context object, using UTF-8 encoding.
    `protected java.io.Writer` | `_createWriter(java.io.OutputStream out, JsonEncoding enc, IOContext ctxt)`
    `protected java.io.DataInput` | `_decorate(java.io.DataInput in, IOContext ctxt)`
    `protected java.io.InputStream` | `_decorate(java.io.InputStream in, IOContext ctxt)`
    `protected java.io.OutputStream` | `_decorate(java.io.OutputStream out, IOContext ctxt)`
    `protected java.io.Reader` | `_decorate(java.io.Reader in, IOContext ctxt)`
    `protected java.io.Writer` | `_decorate(java.io.Writer out, IOContext ctxt)`
    `BufferRecycler` | `_getBufferRecycler()` Method used by factory to create buffer recycler instances for parsers and generators.
    `protected java.io.InputStream` | `_optimizedStreamFromURL(java.net.URL url)` Helper methods used for constructing an optimal stream for parsers to use, when input is to be read from an URL.
    `boolean` | `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.
    `boolean` | `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 `Reader`.
    `boolean` | `canUseSchema(FormatSchema schema)` Method that can be used to quickly check whether given schema is something that parsers and/or generators constructed by this factory could use.
    `JsonFactory` | `configure(JsonFactory.Feature f, boolean state)` Method for enabling or disabling specified parser feature (check `JsonParser.Feature` for list of features)
    `JsonFactory` | `configure(JsonGenerator.Feature f, boolean state)` Method for enabling or disabling specified generator feature (check `JsonGenerator.Feature` for list of features)
    `JsonFactory` | `configure(JsonParser.Feature f, boolean state)` Method for enabling or disabling specified parser feature (check `JsonParser.Feature` for list of features)
    `JsonFactory` | `copy()` Method for constructing a new `JsonFactory` that has the same settings as this instance, but is otherwise independent (i.e.
    `JsonGenerator` | `createGenerator(java.io.DataOutput out)` Convenience method for constructing generator that uses default encoding of the format (UTF-8 for JSON and most other data formats).
    `JsonGenerator` | `createGenerator(java.io.DataOutput out, JsonEncoding enc)` Method for constructing generator for writing content using specified `DataOutput` instance.
    `JsonGenerator` | `createGenerator(java.io.File f, JsonEncoding enc)` Method for constructing JSON generator for writing JSON content to specified file, overwriting contents it might have (or creating it if such file does not yet exist).
    `JsonGenerator` | `createGenerator(java.io.OutputStream out)` Convenience method for constructing generator that uses default encoding of the format (UTF-8 for JSON and most other data formats).
    `JsonGenerator` | `createGenerator(java.io.OutputStream out, JsonEncoding enc)` Method for constructing JSON generator for writing JSON content using specified output stream.
    `JsonGenerator` | `createGenerator(java.io.Writer w)` Method for constructing JSON generator for writing JSON content using specified Writer.
    `JsonGenerator` | `createJsonGenerator(java.io.OutputStream out)` Deprecated. Since 2.2, use `createGenerator(OutputStream)` instead.
    `JsonGenerator` | `createJsonGenerator(java.io.OutputStream out, JsonEncoding enc)` Deprecated. Since 2.2, use `createGenerator(OutputStream, JsonEncoding)` instead.
    `JsonGenerator` | `createJsonGenerator(java.io.Writer out)` Deprecated. Since 2.2, use `createGenerator(Writer)` instead.
    `JsonParser` | `createJsonParser(byte[] data)` Deprecated. Since 2.2, use `createParser(byte[])` instead.
    `JsonParser` | `createJsonParser(byte[] data, int offset, int len)` Deprecated. Since 2.2, use `createParser(byte[],int,int)` instead.
    `JsonParser` | `createJsonParser(java.io.File f)` Deprecated. Since 2.2, use `createParser(File)` instead.
    `JsonParser` | `createJsonParser(java.io.InputStream in)` Deprecated. Since 2.2, use `createParser(InputStream)` instead.
    `JsonParser` | `createJsonParser(java.io.Reader r)` Deprecated. Since 2.2, use `createParser(Reader)` instead.
    `JsonParser` | `createJsonParser(java.lang.String content)` Deprecated. Since 2.2, use `createParser(String)` instead.
    `JsonParser` | `createJsonParser(java.net.URL url)` Deprecated. Since 2.2, use `createParser(URL)` instead.
    `JsonParser` | `createParser(byte[] data)` Method for constructing parser for parsing the contents of given byte array.
    `JsonParser` | `createParser(byte[] data, int offset, int len)` Method for constructing parser for parsing the contents of given byte array.
    `JsonParser` | `createParser(char[] content)` Method for constructing parser for parsing contents of given char array.
    `JsonParser` | `createParser(char[] content, int offset, int len)` Method for constructing parser for parsing contents of given char array.
    `JsonParser` | `createParser(java.io.DataInput in)`
    `JsonParser` | `createParser(java.io.File f)` Method for constructing JSON parser instance to parse contents of specified file.
    `JsonParser` | `createParser(java.io.InputStream in)` Method for constructing JSON parser instance to parse the contents accessed via specified input stream.
    `JsonParser` | `createParser(java.io.Reader r)` Method for constructing parser for parsing the contents accessed via specified Reader.
    `JsonParser` | `createParser(java.lang.String content)` Method for constructing parser for parsing contents of given String.
    `JsonParser` | `createParser(java.net.URL url)` Method for constructing JSON parser instance to parse contents of resource reference by given URL.
    `JsonFactory` | `disable(JsonFactory.Feature f)` Method for disabling specified parser features (check `JsonFactory.Feature` for list of features)
    `JsonFactory` | `disable(JsonGenerator.Feature f)` Method for disabling specified generator feature (check `JsonGenerator.Feature` for list of features)
    `JsonFactory` | `disable(JsonParser.Feature f)` Method for disabling specified parser features (check `JsonParser.Feature` for list of features)
    `JsonFactory` | `enable(JsonFactory.Feature f)` Method for enabling specified parser feature (check `JsonFactory.Feature` for list of features)
    `JsonFactory` | `enable(JsonGenerator.Feature f)` Method for enabling specified generator features (check `JsonGenerator.Feature` for list of features)
    `JsonFactory` | `enable(JsonParser.Feature f)` Method for enabling specified parser feature (check `JsonParser.Feature` for list of features)
    `CharacterEscapes` | `getCharacterEscapes()` Method for accessing custom escapes factory uses for `JsonGenerator`s it creates.
    `ObjectCodec` | `getCodec()`
    `java.lang.String` | `getFormatName()` Method that returns short textual id identifying format this factory supports.
    `java.lang.Class<? extends FormatFeature>` | `getFormatReadFeatureType()` Method for accessing kind of `FormatFeature` that a parser `JsonParser` produced by this factory would accept, if any; `null` returned if none.
    `java.lang.Class<? extends FormatFeature>` | `getFormatWriteFeatureType()` Method for accessing kind of `FormatFeature` that a parser `JsonGenerator` produced by this factory would accept, if any; `null` returned if none.
    `InputDecorator` | `getInputDecorator()` Method for getting currently configured input decorator (if any; there is no default decorator).
    `OutputDecorator` | `getOutputDecorator()` Method for getting currently configured output decorator (if any; there is no default decorator).
    `java.lang.String` | `getRootValueSeparator()`
    `MatchStrength` | `hasFormat(InputAccessor acc)` Convenience method for trying to determine whether input via given accessor is of format type supported by this factory.
    `protected MatchStrength` | `hasJSONFormat(InputAccessor acc)` Helper method that can be called to determine if content accessed using given accessor seems to be JSON content.
    `boolean` | `isEnabled(JsonFactory.Feature f)` Checked whether specified parser feature is enabled.
    `boolean` | `isEnabled(JsonGenerator.Feature f)` Check whether specified generator feature is enabled.
    `boolean` | `isEnabled(JsonParser.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.
    `boolean` | `requiresCustomCodec()` Method that can be called to determine if a custom `ObjectCodec` is needed for binding data parsed using `JsonParser` constructed by this factory (which typically also implies the same for serialization with `JsonGenerator`).
    `boolean` | `requiresPropertyOrdering()` Introspection method that higher-level functionality may call to see whether underlying data format requires a stable ordering of object properties or not.
    `JsonFactory` | `setCharacterEscapes(CharacterEscapes esc)` Method for defining custom escapes factory uses for `JsonGenerator`s it creates.
    `JsonFactory` | `setCodec(ObjectCodec oc)` Method for associating a `ObjectCodec` (typically a `com.fasterxml.jackson.databind.ObjectMapper`) with this factory (and more importantly, parsers and generators it constructs).
    `JsonFactory` | `setInputDecorator(InputDecorator d)` Method for overriding currently configured input decorator
    `JsonFactory` | `setOutputDecorator(OutputDecorator d)` Method for overriding currently configured output decorator
    `JsonFactory` | `setRootValueSeparator(java.lang.String sep)` Method that allows overriding String used for separating root-level JSON values (default is single space character)
    `Version` | `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).

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### FORMAT_NAME_JSON

          public static final java.lang.String FORMAT_NAME_JSON

      Name used to identify JSON format (and returned by `getFormatName()`
      See Also:
        Constant Field Values

    - #### DEFAULT_FACTORY_FEATURE_FLAGS

          protected static final int DEFAULT_FACTORY_FEATURE_FLAGS

      Bitfield (set of flags) of all factory features that are enabled by default.

    - #### DEFAULT_PARSER_FEATURE_FLAGS

          protected static final int DEFAULT_PARSER_FEATURE_FLAGS

      Bitfield (set of flags) of all parser features that are enabled by default.

    - #### DEFAULT_GENERATOR_FEATURE_FLAGS

          protected static final int DEFAULT_GENERATOR_FEATURE_FLAGS

      Bitfield (set of flags) of all generator features that are enabled by default.

    - #### _recyclerRef

          protected static final java.lang.ThreadLocal<java.lang.ref.SoftReference<BufferRecycler>> _recyclerRef

      This `ThreadLocal` contains a `SoftReference` to a `BufferRecycler` used to provide a low-cost buffer recycling between reader and writer instances.

    - #### _rootCharSymbols

          protected final transient CharsToNameCanonicalizer _rootCharSymbols

      Each factory comes equipped with a shared root symbol table. It should not be linked back to the original blueprint, to avoid contents from leaking between factories.

    - #### _byteSymbolCanonicalizer

          protected final transient ByteQuadsCanonicalizer _byteSymbolCanonicalizer

      Alternative to the basic symbol table, some stream-based parsers use different name canonicalization method.

      TODO: should clean up this; looks messy having 2 alternatives with not very clear differences.

      Since:
        2.6.0

    - #### _objectCodec

          protected ObjectCodec _objectCodec

      Object that implements conversion functionality between Java objects and JSON content. For base JsonFactory implementation usually not set by default, but can be explicitly set. Sub-classes (like @link org.codehaus.jackson.map.MappingJsonFactory} usually provide an implementation.

    - #### _factoryFeatures

          protected int _factoryFeatures

      Currently enabled factory features.

    - #### _parserFeatures

          protected int _parserFeatures

      Currently enabled parser features.

    - #### _generatorFeatures

          protected int _generatorFeatures

      Currently enabled generator features.

    - #### _characterEscapes

          protected CharacterEscapes _characterEscapes

      Definition of custom character escapes to use for generators created by this factory, if any. If null, standard data format specific escapes are used.

    - #### _inputDecorator

          protected InputDecorator _inputDecorator

      Optional helper object that may decorate input sources, to do additional processing on input during parsing.

    - #### _outputDecorator

          protected OutputDecorator _outputDecorator

      Optional helper object that may decorate output object, to do additional processing on output during content generation.

    - #### _rootValueSeparator

          protected SerializableString _rootValueSeparator

      Separator used between root-level values, if any; null indicates "do not add separator". Default separator is a single space character.
      Since:
        2.1

  - ### Constructor Detail

    - #### JsonFactory

          public JsonFactory()

      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.

    - #### JsonFactory

          public JsonFactory(ObjectCodec oc)

    - #### JsonFactory

          protected JsonFactory(JsonFactory src,
                     ObjectCodec codec)

      Constructor used when copy()ing a factory instance.
      Since:
        2.2.1

  - ### Method Detail

    - #### copy

          public 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). Note that `ObjectCodec` reference is not copied but is set to null; caller typically needs to set it after calling this method. Reason for this is that the codec is used for callbacks, and assumption is that there is strict 1-to-1 mapping between codec, factory. Caller has to, then, explicitly set codec after making the copy.
      Since:
        2.1

    - #### _checkInvalidCopy

          protected void _checkInvalidCopy(java.lang.Class<?> exp)

      Parameters:
        `exp` -
      Since:
        2.1

    - #### readResolve

          protected java.lang.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.

    - #### requiresPropertyOrdering

          public boolean requiresPropertyOrdering()

      Introspection method that higher-level functionality may call to see whether underlying data format requires a stable ordering of object properties or not. This is usually used for determining whether to force a stable ordering (like alphabetic ordering by name) if no ordering if explicitly specified.

      Default implementation returns `false` as JSON does NOT require stable ordering. Formats that require ordering include positional textual formats like `CSV`, and schema-based binary formats like `Avro`.

      Since:
        2.3

    - #### canHandleBinaryNatively

          public boolean 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.

      Default implementation returns `false` as JSON does not support native access: all binary content must use Base64 encoding. Most binary formats (like Smile and Avro) support native binary content.

      Since:
        2.3

    - #### canUseCharArrays

          public boolean 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 `Reader`. Sub-types are expected to override definition; default implementation (suitable for JSON) alleges that optimization are possible; and thereby is likely to try to access `String` content by first copying it into recyclable intermediate buffer.
      Since:
        2.4

    - #### getFormatReadFeatureType

          public java.lang.Class<? extends FormatFeature> getFormatReadFeatureType()

      Method for accessing kind of `FormatFeature` that a parser `JsonParser` produced by this factory would accept, if any; `null` returned if none.
      Since:
        2.6

    - #### getFormatWriteFeatureType

          public java.lang.Class<? extends FormatFeature> getFormatWriteFeatureType()

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

    - #### canUseSchema

          public boolean canUseSchema(FormatSchema schema)

      Method that can be used to quickly check whether given schema is something that parsers and/or generators constructed by this factory could use. Note that this means possible use, at the level of data format (i.e. schema is for same data format as parsers and generators this factory constructs); individual schema instances may have further usage restrictions.
      Since:
        2.1

    - #### getFormatName

          public java.lang.String getFormatName()

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

      Note: sub-classes should override this method; default implementation will return null for all sub-classes

    - #### hasFormat

          public MatchStrength hasFormat(InputAccessor acc)
                                  throws java.io.IOException

      Convenience method for trying to determine whether input via given accessor is of format type supported by this factory.
      Throws:
        `java.io.IOException`

    - #### requiresCustomCodec

          public boolean requiresCustomCodec()

      Method that can be called to determine if a custom `ObjectCodec` is needed for binding data parsed using `JsonParser` constructed by this factory (which typically also implies the same for serialization with `JsonGenerator`).
      Returns:
        True if custom codec is needed with parsers and generators created by this factory; false if a general `ObjectCodec` is enough
      Since:
        2.1

    - #### hasJSONFormat

          protected MatchStrength hasJSONFormat(InputAccessor acc)
                                         throws java.io.IOException

      Helper method that can be called to determine if content accessed using given accessor seems to be JSON content.
      Throws:
        `java.io.IOException`

    - #### version

          public Version version()

      Description copied from interface: `Versioned`
      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).
      Specified by:
        `version` in interface `Versioned`

    - #### configure

          public final JsonFactory configure(JsonFactory.Feature f,
                              boolean state)

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

    - #### enable

          public JsonFactory enable(JsonFactory.Feature f)

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

    - #### disable

          public JsonFactory disable(JsonFactory.Feature f)

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

    - #### isEnabled

          public final boolean isEnabled(JsonFactory.Feature f)

      Checked whether specified parser feature is enabled.

    - #### configure

          public final JsonFactory configure(JsonParser.Feature f,
                              boolean state)

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

    - #### enable

          public JsonFactory enable(JsonParser.Feature f)

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

    - #### disable

          public JsonFactory disable(JsonParser.Feature f)

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

    - #### isEnabled

          public final boolean isEnabled(JsonParser.Feature f)

      Checked whether specified parser feature is enabled.

    - #### getInputDecorator

          public InputDecorator getInputDecorator()

      Method for getting currently configured input decorator (if any; there is no default decorator).

    - #### setInputDecorator

          public JsonFactory setInputDecorator(InputDecorator d)

      Method for overriding currently configured input decorator

    - #### configure

          public final JsonFactory configure(JsonGenerator.Feature f,
                              boolean state)

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

    - #### enable

          public JsonFactory enable(JsonGenerator.Feature f)

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

    - #### disable

          public JsonFactory disable(JsonGenerator.Feature f)

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

    - #### isEnabled

          public final boolean isEnabled(JsonGenerator.Feature f)

      Check whether specified generator feature is enabled.

    - #### getCharacterEscapes

          public CharacterEscapes getCharacterEscapes()

      Method for accessing custom escapes factory uses for `JsonGenerator`s it creates.

    - #### setCharacterEscapes

          public JsonFactory setCharacterEscapes(CharacterEscapes esc)

      Method for defining custom escapes factory uses for `JsonGenerator`s it creates.

    - #### getOutputDecorator

          public OutputDecorator getOutputDecorator()

      Method for getting currently configured output decorator (if any; there is no default decorator).

    - #### setOutputDecorator

          public JsonFactory setOutputDecorator(OutputDecorator d)

      Method for overriding currently configured output decorator

    - #### setRootValueSeparator

          public JsonFactory setRootValueSeparator(java.lang.String sep)

      Method that allows overriding String used for separating root-level JSON values (default is single space character)
      Parameters:
        `sep` - Separator to use, if any; null means that no separator is automatically added
      Since:
        2.1

    - #### getRootValueSeparator

          public java.lang.String getRootValueSeparator()

      Since:
        2.1

    - #### setCodec

          public JsonFactory setCodec(ObjectCodec oc)

      Method for associating a `ObjectCodec` (typically a `com.fasterxml.jackson.databind.ObjectMapper`) with this factory (and more importantly, parsers and generators it constructs). This is needed to use data-binding methods of `JsonParser` and `JsonGenerator` instances.

    - #### getCodec

          public ObjectCodec getCodec()

    - #### createParser

          public JsonParser createParser(java.io.File f)
                                  throws java.io.IOException,
                                         JsonParseException

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

      Encoding is auto-detected from contents according to JSON specification recommended mechanism. Json specification supports only UTF-8, UTF-16 and UTF-32 as valid encodings, so auto-detection implemented only for this charsets. For other charsets use `createParser(java.io.Reader)`.

      Underlying input stream (needed for reading contents) will be owned (and managed, i.e. closed as need be) by the parser, since caller has no access to it.

      Parameters:
        `f` - File that contains JSON content to parse
      Throws:
        `java.io.IOException`
        `JsonParseException`
      Since:
        2.1

    - #### createParser

          public JsonParser createParser(java.net.URL url)
                                  throws java.io.IOException,
                                         JsonParseException

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

      Encoding is auto-detected from contents according to JSON specification recommended mechanism. Json specification supports only UTF-8, UTF-16 and UTF-32 as valid encodings, so auto-detection implemented only for this charsets. For other charsets use `createParser(java.io.Reader)`.

      Underlying input stream (needed for reading contents) will be owned (and managed, i.e. closed as need be) by the parser, since caller has no access to it.

      Parameters:
        `url` - URL pointing to resource that contains JSON content to parse
      Throws:
        `java.io.IOException`
        `JsonParseException`
      Since:
        2.1

    - #### createParser

          public JsonParser createParser(java.io.InputStream in)
                                  throws java.io.IOException,
                                         JsonParseException

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

      The input stream will not be owned by the parser, it will still be managed (i.e. closed if end-of-stream is reacher, or parser close method called) if (and only if) `JsonParser.Feature.AUTO_CLOSE_SOURCE` is enabled.

      Note: no encoding argument is taken since it can always be auto-detected as suggested by JSON RFC. Json specification supports only UTF-8, UTF-16 and UTF-32 as valid encodings, so auto-detection implemented only for this charsets. For other charsets use `createParser(java.io.Reader)`.

      Parameters:
        `in` - InputStream to use for reading JSON content to parse
      Throws:
        `java.io.IOException`
        `JsonParseException`
      Since:
        2.1

    - #### createParser

          public JsonParser createParser(java.io.Reader r)
                                  throws java.io.IOException,
                                         JsonParseException

      Method for constructing parser for parsing the contents accessed via specified Reader.

      The read stream will not be owned by the parser, it will still be managed (i.e. closed if end-of-stream is reacher, or parser close method called) if (and only if) `JsonParser.Feature.AUTO_CLOSE_SOURCE` is enabled.

      Parameters:
        `r` - Reader to use for reading JSON content to parse
      Throws:
        `java.io.IOException`
        `JsonParseException`
      Since:
        2.1

    - #### createParser

          public JsonParser createParser(byte[] data)
                                  throws java.io.IOException,
                                         JsonParseException

      Method for constructing parser for parsing the contents of given byte array.
      Throws:
        `java.io.IOException`
        `JsonParseException`
      Since:
        2.1

    - #### createParser

          public JsonParser createParser(byte[] data,
                                int offset,
                                int len)
                                  throws java.io.IOException,
                                         JsonParseException

      Method for constructing parser for parsing the contents of given byte array.
      Parameters:
        `data` - Buffer that contains data to parse
        `offset` - Offset of the first data byte within buffer
        `len` - Length of contents to parse within buffer
      Throws:
        `java.io.IOException`
        `JsonParseException`
      Since:
        2.1

    - #### createParser

          public JsonParser createParser(java.lang.String content)
                                  throws java.io.IOException,
                                         JsonParseException

      Method for constructing parser for parsing contents of given String.
      Throws:
        `java.io.IOException`
        `JsonParseException`
      Since:
        2.1

    - #### createParser

          public JsonParser createParser(char[] content)
                                  throws java.io.IOException

      Method for constructing parser for parsing contents of given char array.
      Throws:
        `java.io.IOException`
      Since:
        2.4

    - #### createParser

          public JsonParser createParser(char[] content,
                                int offset,
                                int len)
                                  throws java.io.IOException

      Method for constructing parser for parsing contents of given char array.
      Throws:
        `java.io.IOException`
      Since:
        2.4

    - #### createParser

          public JsonParser createParser(java.io.DataInput in)
                                  throws java.io.IOException

      Throws:
        `java.io.IOException`
      Since:
        2.8

    - #### createJsonParser

          @Deprecated
          public JsonParser createJsonParser(java.io.File f)
                                      throws java.io.IOException,
                                             JsonParseException

      Deprecated. Since 2.2, use `createParser(File)` instead.
      Method for constructing JSON parser instance to parse contents of specified file.

      Encoding is auto-detected from contents according to JSON specification recommended mechanism. Json specification supports only UTF-8, UTF-16 and UTF-32 as valid encodings, so auto-detection implemented only for this charsets. For other charsets use `createParser(java.io.Reader)`.

      Underlying input stream (needed for reading contents) will be owned (and managed, i.e. closed as need be) by the parser, since caller has no access to it.

      Parameters:
        `f` - File that contains JSON content to parse
      Throws:
        `java.io.IOException`
        `JsonParseException`

    - #### createJsonParser

          @Deprecated
          public JsonParser createJsonParser(java.net.URL url)
                                      throws java.io.IOException,
                                             JsonParseException

      Deprecated. Since 2.2, use `createParser(URL)` instead.
      Method for constructing JSON parser instance to parse contents of resource reference by given URL.

      Encoding is auto-detected from contents according to JSON specification recommended mechanism. Json specification supports only UTF-8, UTF-16 and UTF-32 as valid encodings, so auto-detection implemented only for this charsets. For other charsets use `createParser(java.io.Reader)`.

      Underlying input stream (needed for reading contents) will be owned (and managed, i.e. closed as need be) by the parser, since caller has no access to it.

      Parameters:
        `url` - URL pointing to resource that contains JSON content to parse
      Throws:
        `java.io.IOException`
        `JsonParseException`

    - #### createJsonParser

          @Deprecated
          public JsonParser createJsonParser(java.io.InputStream in)
                                      throws java.io.IOException,
                                             JsonParseException

      Deprecated. Since 2.2, use `createParser(InputStream)` instead.
      Method for constructing JSON parser instance to parse the contents accessed via specified input stream.

      The input stream will not be owned by the parser, it will still be managed (i.e. closed if end-of-stream is reacher, or parser close method called) if (and only if) `JsonParser.Feature.AUTO_CLOSE_SOURCE` is enabled.

      Note: no encoding argument is taken since it can always be auto-detected as suggested by JSON RFC. Json specification supports only UTF-8, UTF-16 and UTF-32 as valid encodings, so auto-detection implemented only for this charsets. For other charsets use `createParser(java.io.Reader)`.

      Parameters:
        `in` - InputStream to use for reading JSON content to parse
      Throws:
        `java.io.IOException`
        `JsonParseException`

    - #### createJsonParser

          @Deprecated
          public JsonParser createJsonParser(java.io.Reader r)
                                      throws java.io.IOException,
                                             JsonParseException

      Deprecated. Since 2.2, use `createParser(Reader)` instead.
      Method for constructing parser for parsing the contents accessed via specified Reader.

      The read stream will not be owned by the parser, it will still be managed (i.e. closed if end-of-stream is reacher, or parser close method called) if (and only if) `JsonParser.Feature.AUTO_CLOSE_SOURCE` is enabled.

      Parameters:
        `r` - Reader to use for reading JSON content to parse
      Throws:
        `java.io.IOException`
        `JsonParseException`

    - #### createJsonParser

          @Deprecated
          public JsonParser createJsonParser(byte[] data)
                                      throws java.io.IOException,
                                             JsonParseException

      Deprecated. Since 2.2, use `createParser(byte[])` instead.
      Method for constructing parser for parsing the contents of given byte array.
      Throws:
        `java.io.IOException`
        `JsonParseException`

    - #### createJsonParser

          @Deprecated
          public JsonParser createJsonParser(byte[] data,
                                               int offset,
                                               int len)
                                      throws java.io.IOException,
                                             JsonParseException

      Deprecated. Since 2.2, use `createParser(byte[],int,int)` instead.
      Method for constructing parser for parsing the contents of given byte array.
      Parameters:
        `data` - Buffer that contains data to parse
        `offset` - Offset of the first data byte within buffer
        `len` - Length of contents to parse within buffer
      Throws:
        `java.io.IOException`
        `JsonParseException`

    - #### createJsonParser

          @Deprecated
          public JsonParser createJsonParser(java.lang.String content)
                                      throws java.io.IOException,
                                             JsonParseException

      Deprecated. Since 2.2, use `createParser(String)` instead.
      Method for constructing parser for parsing contents of given String.
      Throws:
        `java.io.IOException`
        `JsonParseException`

    - #### createGenerator

          public JsonGenerator createGenerator(java.io.OutputStream out,
                                      JsonEncoding enc)
                                        throws java.io.IOException

      Method for constructing JSON generator for writing JSON content using specified output stream. Encoding to use must be specified, and needs to be one of available types (as per JSON specification).

      Underlying stream is NOT owned by the generator constructed, so that generator will NOT close the output stream when `JsonGenerator.close()` is called (unless auto-closing feature, `JsonGenerator.Feature.AUTO_CLOSE_TARGET` is enabled). Using application needs to close it explicitly if this is the case.

      Note: there are formats that use fixed encoding (like most binary data formats) and that ignore passed in encoding.

      Parameters:
        `out` - OutputStream to use for writing JSON content
        `enc` - Character encoding to use
      Throws:
        `java.io.IOException`
      Since:
        2.1

    - #### createGenerator

          public JsonGenerator createGenerator(java.io.OutputStream out)
                                        throws java.io.IOException

      Convenience method for constructing generator that uses default encoding of the format (UTF-8 for JSON and most other data formats).

      Note: there are formats that use fixed encoding (like most binary data formats).

      Throws:
        `java.io.IOException`
      Since:
        2.1

    - #### createGenerator

          public JsonGenerator createGenerator(java.io.Writer w)
                                        throws java.io.IOException

      Method for constructing JSON generator for writing JSON content using specified Writer.

      Underlying stream is NOT owned by the generator constructed, so that generator will NOT close the Reader when `JsonGenerator.close()` is called (unless auto-closing feature, `JsonGenerator.Feature.AUTO_CLOSE_TARGET` is enabled). Using application needs to close it explicitly.

      Parameters:
        `w` - Writer to use for writing JSON content
      Throws:
        `java.io.IOException`
      Since:
        2.1

    - #### createGenerator

          public JsonGenerator createGenerator(java.io.File f,
                                      JsonEncoding enc)
                                        throws java.io.IOException

      Method for constructing JSON generator for writing JSON content to specified file, overwriting contents it might have (or creating it if such file does not yet exist). Encoding to use must be specified, and needs to be one of available types (as per JSON specification).

      Underlying stream is owned by the generator constructed, i.e. generator will handle closing of file when `JsonGenerator.close()` is called.

      Parameters:
        `f` - File to write contents to
        `enc` - Character encoding to use
      Throws:
        `java.io.IOException`
      Since:
        2.1

    - #### createGenerator

          public JsonGenerator createGenerator(java.io.DataOutput out,
                                      JsonEncoding enc)
                                        throws java.io.IOException

      Method for constructing generator for writing content using specified `DataOutput` instance.
      Throws:
        `java.io.IOException`
      Since:
        2.8

    - #### createGenerator

          public JsonGenerator createGenerator(java.io.DataOutput out)
                                        throws java.io.IOException

      Convenience method for constructing generator that uses default encoding of the format (UTF-8 for JSON and most other data formats).

      Note: there are formats that use fixed encoding (like most binary data formats).

      Throws:
        `java.io.IOException`
      Since:
        2.8

    - #### createJsonGenerator

          @Deprecated
          public JsonGenerator createJsonGenerator(java.io.OutputStream out,
                                                     JsonEncoding enc)
                                            throws java.io.IOException

      Deprecated. Since 2.2, use `createGenerator(OutputStream, JsonEncoding)` instead.
      Method for constructing JSON generator for writing JSON content using specified output stream. Encoding to use must be specified, and needs to be one of available types (as per JSON specification).

      Underlying stream is NOT owned by the generator constructed, so that generator will NOT close the output stream when `JsonGenerator.close()` is called (unless auto-closing feature, `JsonGenerator.Feature.AUTO_CLOSE_TARGET` is enabled). Using application needs to close it explicitly if this is the case.

      Note: there are formats that use fixed encoding (like most binary data formats) and that ignore passed in encoding.

      Parameters:
        `out` - OutputStream to use for writing JSON content
        `enc` - Character encoding to use
      Throws:
        `java.io.IOException`

    - #### createJsonGenerator

          @Deprecated
          public JsonGenerator createJsonGenerator(java.io.Writer out)
                                            throws java.io.IOException

      Deprecated. Since 2.2, use `createGenerator(Writer)` instead.
      Method for constructing JSON generator for writing JSON content using specified Writer.

      Underlying stream is NOT owned by the generator constructed, so that generator will NOT close the Reader when `JsonGenerator.close()` is called (unless auto-closing feature, `JsonGenerator.Feature.AUTO_CLOSE_TARGET` is enabled). Using application needs to close it explicitly.

      Parameters:
        `out` - Writer to use for writing JSON content
      Throws:
        `java.io.IOException`

    - #### createJsonGenerator

          @Deprecated
          public JsonGenerator createJsonGenerator(java.io.OutputStream out)
                                            throws java.io.IOException

      Deprecated. Since 2.2, use `createGenerator(OutputStream)` instead.
      Convenience method for constructing generator that uses default encoding of the format (UTF-8 for JSON and most other data formats).

      Note: there are formats that use fixed encoding (like most binary data formats).

      Throws:
        `java.io.IOException`

    - #### _createParser

          protected JsonParser _createParser(java.io.InputStream in,
                                 IOContext ctxt)
                                      throws java.io.IOException

      Overridable factory method that actually instantiates desired parser given `InputStream` and context object.

      This method is specifically designed to remain compatible between minor versions so that sub-classes can count on it being called as expected. That is, it is part of official interface from sub-class perspective, although not a public method available to users of factory implementations.

      Throws:
        `java.io.IOException`
      Since:
        2.1

    - #### _createParser

          protected JsonParser _createParser(java.io.Reader r,
                                 IOContext ctxt)
                                      throws java.io.IOException

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

      This method is specifically designed to remain compatible between minor versions so that sub-classes can count on it being called as expected. That is, it is part of official interface from sub-class perspective, although not a public method available to users of factory implementations.

      Throws:
        `java.io.IOException`
      Since:
        2.1

    - #### _createParser

          protected JsonParser _createParser(char[] data,
                                 int offset,
                                 int len,
                                 IOContext ctxt,
                                 boolean recyclable)
                                      throws java.io.IOException

      Overridable factory method that actually instantiates parser using given `char[]` object for accessing content.
      Throws:
        `java.io.IOException`
      Since:
        2.4

    - #### _createParser

          protected JsonParser _createParser(byte[] data,
                                 int offset,
                                 int len,
                                 IOContext ctxt)
                                      throws java.io.IOException

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

      This method is specifically designed to remain compatible between minor versions so that sub-classes can count on it being called as expected. That is, it is part of official interface from sub-class perspective, although not a public method available to users of factory implementations.

      Throws:
        `java.io.IOException`

    - #### _createParser

          protected JsonParser _createParser(java.io.DataInput input,
                                 IOContext ctxt)
                                      throws java.io.IOException

      Throws:
        `java.io.IOException`
      Since:
        2.8

    - #### _createGenerator

          protected JsonGenerator _createGenerator(java.io.Writer out,
                                       IOContext ctxt)
                                            throws java.io.IOException

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

      This method is specifically designed to remain compatible between minor versions so that sub-classes can count on it being called as expected. That is, it is part of official interface from sub-class perspective, although not a public method available to users of factory implementations.

      Throws:
        `java.io.IOException`

    - #### _createUTF8Generator

          protected JsonGenerator _createUTF8Generator(java.io.OutputStream out,
                                           IOContext ctxt)
                                                throws java.io.IOException

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

      This method is specifically designed to remain compatible between minor versions so that sub-classes can count on it being called as expected. That is, it is part of official interface from sub-class perspective, although not a public method available to users of factory implementations.

      Throws:
        `java.io.IOException`

    - #### _createWriter

          protected java.io.Writer _createWriter(java.io.OutputStream out,
                                     JsonEncoding enc,
                                     IOContext ctxt)
                                          throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### _decorate

          protected final java.io.InputStream _decorate(java.io.InputStream in,
                                      IOContext ctxt)
                                                 throws java.io.IOException

      Throws:
        `java.io.IOException`
      Since:
        2.4

    - #### _decorate

          protected final java.io.Reader _decorate(java.io.Reader in,
                                 IOContext ctxt)
                                            throws java.io.IOException

      Throws:
        `java.io.IOException`
      Since:
        2.4

    - #### _decorate

          protected final java.io.DataInput _decorate(java.io.DataInput in,
                                    IOContext ctxt)
                                               throws java.io.IOException

      Throws:
        `java.io.IOException`
      Since:
        2.8

    - #### _decorate

          protected final java.io.OutputStream _decorate(java.io.OutputStream out,
                                       IOContext ctxt)
                                                  throws java.io.IOException

      Throws:
        `java.io.IOException`
      Since:
        2.4

    - #### _decorate

          protected final java.io.Writer _decorate(java.io.Writer out,
                                 IOContext ctxt)
                                            throws java.io.IOException

      Throws:
        `java.io.IOException`
      Since:
        2.4

    - #### _getBufferRecycler

          public BufferRecycler _getBufferRecycler()

      Method used by factory to create buffer recycler instances for parsers and generators.

      Note: only public to give access for `ObjectMapper`

    - #### _createContext

          protected IOContext _createContext(java.lang.Object srcRef,
                                 boolean resourceManaged)

      Overridable factory method that actually instantiates desired context object.

    - #### _createDataOutputWrapper

          protected java.io.OutputStream _createDataOutputWrapper(java.io.DataOutput out)

      Since:
        2.8

    - #### _optimizedStreamFromURL

          protected java.io.InputStream _optimizedStreamFromURL(java.net.URL url)
                                                         throws java.io.IOException

      Helper methods used for constructing an optimal stream for parsers to use, when input is to be read from an URL. This helps when reading file content via URL.
      Throws:
        `java.io.IOException`