public class

JsonFactory

extends Object
implements Versioned
java.lang.Object
   ↳ com.fasterxml.jackson.core.JsonFactory

Class Overview

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.

Summary

Nested Classes
enum JsonFactory.Feature Enumeration that defines all on/off features that can only be changed for JsonFactory
Constants
String FORMAT_NAME_JSON Name used to identify JSON format (and returned by getFormatName()
Fields
protected static final int DEFAULT_FACTORY_FEATURE_FLAGS Bitfield (set of flags) of all factory features that are enabled by default.
protected static final int DEFAULT_GENERATOR_FEATURE_FLAGS Bitfield (set of flags) of all generator features that are enabled by default.
protected static final int DEFAULT_PARSER_FEATURE_FLAGS Bitfield (set of flags) of all parser features that are enabled by default.
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 final ThreadLocal<SoftReference<BufferRecycler>> _recyclerRef This ThreadLocal contains a java.lang.ref.SoftRerefence to a BufferRecycler used to provide a low-cost buffer recycling between reader and writer instances.
protected BytesToNameCanonicalizer _rootByteSymbols Alternative to the basic symbol table, some stream-based parsers use different name canonicalization method.
protected CharsToNameCanonicalizer _rootCharSymbols Each factory comes equipped with a shared root symbol table.
Public Constructors
JsonFactory()
Default constructor used to create factory instances.
JsonFactory(ObjectCodec oc)
Public Methods
BufferRecycler _getBufferRecycler()
Method used by factory to create buffer recycler instances for parsers and generators.
final JsonFactory configure(JsonFactory.Feature f, boolean state)
Method for enabling or disabling specified parser feature (check JsonParser.Feature for list of features)
final JsonFactory configure(JsonParser.Feature f, boolean state)
Method for enabling or disabling specified parser feature (check JsonParser.Feature for list of features)
final JsonFactory configure(JsonGenerator.Feature f, boolean state)
Method for enabling or disabling specified generator feature (check JsonGenerator.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(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(OutputStream out, JsonEncoding enc)
Method for constructing JSON generator for writing JSON content using specified output stream.
JsonGenerator createGenerator(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(Writer out)
Method for constructing JSON generator for writing JSON content using specified Writer.
JsonGenerator createJsonGenerator(Writer out)
Method for constructing JSON generator for writing JSON content using specified Writer.
JsonGenerator createJsonGenerator(OutputStream out)
Convenience method for constructing generator that uses default encoding of the format (UTF-8 for JSON and most other data formats).
JsonGenerator createJsonGenerator(OutputStream out, JsonEncoding enc)
Method for constructing JSON generator for writing JSON content using specified output stream.
JsonGenerator createJsonGenerator(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).
JsonParser createJsonParser(String content)
Method for constructing parser for parsing contents of given String.
JsonParser createJsonParser(byte[] data, int offset, int len)
Method for constructing parser for parsing the contents of given byte array.
JsonParser createJsonParser(URL url)
Method for constructing JSON parser instance to parse contents of resource reference by given URL.
JsonParser createJsonParser(File f)
Method for constructing JSON parser instance to parse contents of specified file.
JsonParser createJsonParser(byte[] data)
Method for constructing parser for parsing the contents of given byte array.
JsonParser createJsonParser(InputStream in)
Method for constructing JSON parser instance to parse the contents accessed via specified input stream.
JsonParser createJsonParser(Reader r)
Method for constructing parser for parsing the contents accessed via specified Reader.
JsonParser createParser(String content)
Method for constructing parser for parsing contents of given String.
JsonParser createParser(File f)
Method for constructing JSON parser instance to parse contents of specified file.
JsonParser createParser(Reader r)
Method for constructing parser for parsing the contents accessed via specified Reader.
JsonParser createParser(URL url)
Method for constructing JSON parser instance to parse contents of resource reference by given URL.
JsonParser createParser(byte[] data, int offset, int len)
Method for constructing parser for parsing the contents of given byte array.
JsonParser createParser(byte[] data)
Method for constructing parser for parsing the contents of given byte array.
JsonParser createParser(InputStream in)
Method for constructing JSON parser instance to parse the contents accessed via specified input stream.
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 disable(JsonFactory.Feature f)
Method for disabling specified parser features (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)
JsonFactory enable(JsonFactory.Feature f)
Method for enabling specified parser feature (check JsonFactory.Feature for list of features)
CharacterEscapes getCharacterEscapes()
Method for accessing custom escapes factory uses for JsonGenerators it creates.
ObjectCodec getCodec()
String getFormatName()
Method that returns short textual id identifying format this factory supports.
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).
MatchStrength hasFormat(InputAccessor acc)
final boolean isEnabled(JsonGenerator.Feature f)
Check whether specified generator feature is enabled.
final boolean isEnabled(JsonParser.Feature f)
Checked whether specified parser feature is enabled.
final boolean isEnabled(JsonFactory.Feature f)
Checked whether specified parser feature is enabled.
JsonFactory setCharacterEscapes(CharacterEscapes esc)
Method for defining custom escapes factory uses for JsonGenerators 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
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).
Protected Methods
void _checkInvalidCopy(Class<?> exp)
IOContext _createContext(Object srcRef, boolean resourceManaged)
Overridable factory method that actually instantiates desired context object.
JsonGenerator _createGenerator(Writer out, IOContext ctxt)
Overridable factory method that actually instantiates generator for given Writer and context object.
JsonGenerator _createJsonGenerator(Writer out, IOContext ctxt)
This method is deprecated. since 2.1 -- use _createGenerator(Writer, IOContext) instead
JsonParser _createJsonParser(byte[] data, int offset, int len, IOContext ctxt)
This method is deprecated. since 2.1 -- use _createParser(byte[], int, int, IOContext) instead
JsonParser _createJsonParser(Reader r, IOContext ctxt)
This method is deprecated. since 2.1 -- use _createParser(Reader, IOContext) instead
JsonParser _createJsonParser(InputStream in, IOContext ctxt)
This method is deprecated. since 2.1 -- use _createParser(InputStream, IOContext) instead
JsonParser _createParser(InputStream in, IOContext ctxt)
Overridable factory method that actually instantiates desired parser given InputStream and context object.
JsonParser _createParser(Reader r, IOContext ctxt)
Overridable factory method that actually instantiates parser using given Reader object for reading content.
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.
JsonGenerator _createUTF8Generator(OutputStream out, IOContext ctxt)
Overridable factory method that actually instantiates generator for given OutputStream and context object, using UTF-8 encoding.
JsonGenerator _createUTF8JsonGenerator(OutputStream out, IOContext ctxt)
This method is deprecated. since 2.1
Writer _createWriter(OutputStream out, JsonEncoding enc, IOContext ctxt)
InputStream _optimizedStreamFromURL(URL url)
Helper methods used for constructing an optimal stream for parsers to use, when input is to be read from an URL.
MatchStrength hasJSONFormat(InputAccessor acc)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.fasterxml.jackson.core.Versioned

Constants

public static final String FORMAT_NAME_JSON

Name used to identify JSON format (and returned by getFormatName()

Constant Value: "JSON"

Fields

protected static final int DEFAULT_FACTORY_FEATURE_FLAGS

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

protected static final int DEFAULT_GENERATOR_FEATURE_FLAGS

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

protected static final int DEFAULT_PARSER_FEATURE_FLAGS

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

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.

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

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 final ThreadLocal<SoftReference<BufferRecycler>> _recyclerRef

This ThreadLocal contains a java.lang.ref.SoftRerefence to a BufferRecycler used to provide a low-cost buffer recycling between reader and writer instances.

protected BytesToNameCanonicalizer _rootByteSymbols

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.

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

Public Constructors

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.

public JsonFactory (ObjectCodec oc)

Public Methods

public BufferRecycler _getBufferRecycler ()

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

Note: only public to give access for ObjectMapper

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

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

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

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

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

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

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.

public JsonGenerator createGenerator (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). 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 close() is called.

NOTE: starting with 2.1, should not be used (will be deprecated in 2.2); instead, should call createGenerator.

Parameters
f File to write contents to
enc Character encoding to use
Throws
IOException

public JsonGenerator createGenerator (OutputStream out, JsonEncoding enc)

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 close() is called (unless auto-closing 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.

NOTE: starting with 2.1, should not be used (will be deprecated in 2.2); instead, should call createGenerator.

Parameters
out OutputStream to use for writing JSON content
enc Character encoding to use
Throws
IOException

public JsonGenerator createGenerator (OutputStream out)

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).

NOTE: starting with 2.1, should not be used (will be deprecated in 2.2); instead, should call createGenerator.

Throws
IOException

public JsonGenerator createGenerator (Writer out)

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 close() is called (unless auto-closing feature, AUTO_CLOSE_TARGET is enabled). Using application needs to close it explicitly.

NOTE: starting with 2.1, should not be used (will be deprecated in 2.2); instead, should call createGenerator.

Parameters
out Writer to use for writing JSON content
Throws
IOException

public JsonGenerator createJsonGenerator (Writer out)

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 close() is called (unless auto-closing feature, AUTO_CLOSE_TARGET is enabled). Using application needs to close it explicitly.

NOTE: starting with 2.1, should not be used (will be deprecated in 2.2); instead, should call createGenerator.

Parameters
out Writer to use for writing JSON content
Throws
IOException

public JsonGenerator createJsonGenerator (OutputStream out)

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).

NOTE: starting with 2.1, should not be used (will be deprecated in 2.2); instead, should call createGenerator.

Throws
IOException

public JsonGenerator createJsonGenerator (OutputStream out, JsonEncoding enc)

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 close() is called (unless auto-closing 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.

NOTE: starting with 2.1, should not be used (will be deprecated in 2.2); instead, should call createGenerator.

Parameters
out OutputStream to use for writing JSON content
enc Character encoding to use
Throws
IOException

public JsonGenerator createJsonGenerator (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). 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 close() is called.

NOTE: starting with 2.1, should not be used (will be deprecated in 2.2); instead, should call createGenerator.

Parameters
f File to write contents to
enc Character encoding to use
Throws
IOException

public JsonParser createJsonParser (String content)

Method for constructing parser for parsing contents of given String.

NOTE: as of 2.1, should not be used (will be deprecated in 2.2); instead, should call createParser.

public JsonParser createJsonParser (byte[] data, int offset, int len)

Method for constructing parser for parsing the contents of given byte array.

NOTE: as of 2.1, should not be used (will be deprecated in 2.2); instead, should call createParser.

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

public JsonParser createJsonParser (URL url)

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.

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.

NOTE: as of 2.1, should not be used (will be deprecated in 2.2); instead, should call createParser.

Parameters
url URL pointing to resource that contains JSON content to parse

public JsonParser createJsonParser (File f)

Method for constructing JSON parser instance to parse contents of specified file. Encoding is auto-detected from contents according to JSON specification recommended mechanism.

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.

NOTE: as of 2.1, should not be used (will be deprecated in 2.2); instead, should call createParser.

Parameters
f File that contains JSON content to parse

public JsonParser createJsonParser (byte[] data)

Method for constructing parser for parsing the contents of given byte array.

NOTE: as of 2.1, should not be used (will be deprecated in 2.2); instead, should call createParser.

public JsonParser createJsonParser (InputStream in)

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) AUTO_CLOSE_SOURCE is enabled.

Note: no encoding argument is taken since it can always be auto-detected as suggested by JSON RFC.

NOTE: as of 2.1, should not be used (will be deprecated in 2.2); instead, should call createParser.

Parameters
in InputStream to use for reading JSON content to parse

public JsonParser createJsonParser (Reader r)

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) AUTO_CLOSE_SOURCE is enabled.

NOTE: as of 2.1, should not be used (will be deprecated in 2.2); instead, should call createParser.

Parameters
r Reader to use for reading JSON content to parse

public JsonParser createParser (String content)

Method for constructing parser for parsing contents of given String.

public JsonParser createParser (File f)

Method for constructing JSON parser instance to parse contents of specified file. Encoding is auto-detected from contents according to JSON specification recommended mechanism.

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

public JsonParser createParser (Reader r)

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) AUTO_CLOSE_SOURCE is enabled.

Parameters
r Reader to use for reading JSON content to parse

public JsonParser createParser (URL url)

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.

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

public JsonParser createParser (byte[] data, int offset, int len)

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

public JsonParser createParser (byte[] data)

Method for constructing parser for parsing the contents of given byte array.

public JsonParser createParser (InputStream in)

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) AUTO_CLOSE_SOURCE is enabled.

Note: no encoding argument is taken since it can always be auto-detected as suggested by JSON RFC.

Parameters
in InputStream to use for reading JSON content to parse

public JsonFactory disable (JsonGenerator.Feature f)

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

public JsonFactory disable (JsonParser.Feature f)

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

public JsonFactory disable (JsonFactory.Feature f)

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

public JsonFactory enable (JsonGenerator.Feature f)

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

public JsonFactory enable (JsonParser.Feature f)

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

public JsonFactory enable (JsonFactory.Feature f)

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

public CharacterEscapes getCharacterEscapes ()

Method for accessing custom escapes factory uses for JsonGenerators it creates.

public ObjectCodec getCodec ()

public 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

public InputDecorator getInputDecorator ()

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

public OutputDecorator getOutputDecorator ()

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

public MatchStrength hasFormat (InputAccessor acc)

Throws
IOException

public final boolean isEnabled (JsonGenerator.Feature f)

Check whether specified generator feature is enabled.

public final boolean isEnabled (JsonParser.Feature f)

Checked whether specified parser feature is enabled.

public final boolean isEnabled (JsonFactory.Feature f)

Checked whether specified parser feature is enabled.

public JsonFactory setCharacterEscapes (CharacterEscapes esc)

Method for defining custom escapes factory uses for JsonGenerators it creates.

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.

public JsonFactory setInputDecorator (InputDecorator d)

Method for overriding currently configured input decorator

public JsonFactory setOutputDecorator (OutputDecorator d)

Method for overriding currently configured output decorator

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

Protected Methods

protected void _checkInvalidCopy (Class<?> exp)

protected IOContext _createContext (Object srcRef, boolean resourceManaged)

Overridable factory method that actually instantiates desired context object.

protected JsonGenerator _createGenerator (Writer out, IOContext ctxt)

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
IOException

protected JsonGenerator _createJsonGenerator (Writer out, IOContext ctxt)

This method is deprecated.
since 2.1 -- use _createGenerator(Writer, IOContext) instead

Throws
IOException

protected JsonParser _createJsonParser (byte[] data, int offset, int len, IOContext ctxt)

This method is deprecated.
since 2.1 -- use _createParser(byte[], int, int, IOContext) instead

protected JsonParser _createJsonParser (Reader r, IOContext ctxt)

This method is deprecated.
since 2.1 -- use _createParser(Reader, IOContext) instead

protected JsonParser _createJsonParser (InputStream in, IOContext ctxt)

This method is deprecated.
since 2.1 -- use _createParser(InputStream, IOContext) instead

protected JsonParser _createParser (InputStream in, IOContext ctxt)

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.

protected JsonParser _createParser (Reader r, IOContext ctxt)

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.

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.

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.

protected JsonGenerator _createUTF8Generator (OutputStream out, IOContext ctxt)

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
IOException

protected JsonGenerator _createUTF8JsonGenerator (OutputStream out, IOContext ctxt)

This method is deprecated.
since 2.1

Throws
IOException

protected Writer _createWriter (OutputStream out, JsonEncoding enc, IOContext ctxt)

Throws
IOException

protected InputStream _optimizedStreamFromURL (URL url)

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
IOException

protected MatchStrength hasJSONFormat (InputAccessor acc)

Throws
IOException