Top Description Fields Constructors Methods
com.fasterxml.jackson.dataformat.ion

public Class IonFactory

extends JsonFactory
Class Inheritance
Annotations
@SuppressWarnings:resource
Imports
java.io.CharArrayReader, .Closeable, .File, .FileOutputStream, .IOException, .InputStream, .OutputStream, .Reader, .Writer, com.fasterxml.jackson.core.JsonEncoding, .JsonFactory, .JsonGenerator, .JsonParser, .ObjectCodec, .Version, com.fasterxml.jackson.core.io.IOContext, .UTF8Writer, com.fasterxml.jackson.core.util.TextBuffer, com.amazon.ion.IonReader, .IonSystem, .IonValue, .IonWriter, com.amazon.ion.system.IonSystemBuilder

Sub-class of JsonFactory that will work on Ion content, instead of JSON content.

Field Summary

Modifier and TypeField and Description
protected boolean
_cfgCreateBinaryWriters

Whether we will produce binary or text Ion writers: default is textual.

protected int
protected int
protected final IonSystem
protected static final int
DEFAULT_ION_GENERATOR_FEATURE_FLAGS

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

protected static final int
DEFAULT_ION_PARSER_FEATURE_FLAGS

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

public static final String
private static final long
Inherited from com.fasterxml.jackson.core.JsonFactory:
_byteSymbolCanonicalizer_characterEscapes_errorReportConfiguration_factoryFeatures_generatorDecorators_generatorFeatures_inputDecorator_maximumNonEscapedChar_objectCodec_outputDecorator_parserFeatures_quoteChar_recyclerPool_rootCharSymbols_rootValueSeparator_streamReadConstraints_streamWriteConstraintsDEFAULT_FACTORY_FEATURE_FLAGSDEFAULT_GENERATOR_FEATURE_FLAGSDEFAULT_PARSER_FEATURE_FLAGSDEFAULT_QUOTE_CHARDEFAULT_ROOT_VALUE_SEPARATORFORMAT_NAME_JSON

Constructor Summary

AccessConstructor and Description
public
public
public
protected
protected
IonFactory(IonFactoryBuilder b)

Constructors used by IonFactoryBuilder for instantiation.

Method Summary

Modifier and TypeMethod and Description
protected IonGenerator
_createGenerator(OutputStream out, JsonEncoding enc, boolean isManaged)

protected IonGenerator
_createGenerator(IonWriter ion, boolean ionWriterIsManaged, IOContext ctxt, Closeable dst)

protected JsonParser
_createParser(InputStream
InputStream to use for reading content to parse
in
,
IOContext
I/O context to use for parsing
ctxt
)

Overrides com.fasterxml.jackson.core.JsonFactory._createParser.

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

protected JsonParser
_createParser(Reader
Reader to use for reading content to parse
r
,
IOContext
I/O context to use for parsing
ctxt
)

Overrides com.fasterxml.jackson.core.JsonFactory._createParser.

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

protected JsonParser
_createParser(char[]
Buffer that contains content to parse
data
,
int
Offset to the first character of data to parse
offset
,
int
Number of characters within buffer to parse
len
,
IOContext
I/O context to use for parsing
ctxt
,
boolean
Whether input buffer is recycled by the factory
recyclable
)

Overrides com.fasterxml.jackson.core.JsonFactory._createParser.

Overridable factory method that actually instantiates parser using given char[] object for accessing content.

protected JsonParser
_createParser(byte[]
Buffer that contains content to parse
data
,
int
Offset to the first character of data to parse
offset
,
int
Number of characters within buffer to parse
len
,
IOContext
I/O context to use for parsing
ctxt
)

Overrides com.fasterxml.jackson.core.JsonFactory._createParser.

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

protected String
_readAll(Reader r, IOContext ctxt)
Deprecated

public static IonFactoryBuilder
builderForBinaryWriters()

Method for creating IonFactoryBuilder initialized with settings to create binary (not textual) writers.

public static IonFactoryBuilder
builderForTextualWriters()

Method for creating IonFactoryBuilder initialized with settings to create textual (not binary) writers.

public boolean
canHandleBinaryNatively()

Overrides com.fasterxml.jackson.core.JsonFactory.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.

public boolean
canUseCharArrays()

Overrides com.fasterxml.jackson.core.JsonFactory.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 java.io.Reader.

public final IonFactory
configure(IonParser.Feature f, boolean state)

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

public final IonFactory
configure(IonGenerator.Feature f, boolean state)

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

public IonFactory
copy()

Overrides com.fasterxml.jackson.core.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).

public boolean
public JsonGenerator
public JsonGenerator
createGenerator(OutputStream
OutputStream to use for writing JSON content
out
,
JsonEncoding
Character encoding to use
enc
)

Overrides com.fasterxml.jackson.core.JsonFactory.createGenerator.

Method for constructing JSON generator for writing JSON content using specified output stream.

public JsonGenerator
createGenerator(Writer
Writer to use for writing JSON content
out
)

Overrides com.fasterxml.jackson.core.JsonFactory.createGenerator.

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

public JsonGenerator
createGenerator(File
File to write contents to
f
,
JsonEncoding
Character encoding to use
enc
)

Overrides com.fasterxml.jackson.core.JsonFactory.createGenerator.

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

public JsonGenerator
createJsonGenerator(IonWriter out)
Deprecated Since 2.7

public IonParser
createJsonParser(IonReader in)
Deprecated Since 2.7

public IonParser
createJsonParser(IonValue value)
Deprecated Since 2.7

public IonParser
public IonParser
public IonFactory
disable(IonParser.Feature f)

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

public IonFactory
disable(IonGenerator.Feature f)

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

public IonFactory
enable(IonParser.Feature f)

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

public IonFactory
enable(IonGenerator.Feature f)

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

public static IonFactory
forBinaryWriters()

Method for creating IonFactory that will create binary (not textual) writers.

public static IonFactory
forTextualWriters()

Method for creating IonFactory that will create textual (not binary) writers.

public int
public String
getFormatName()

Overrides com.fasterxml.jackson.core.JsonFactory.getFormatName.

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

public int
public IonSystem
public final boolean
isEnabled(IonParser.Feature f)

Checked whether specified parser feature is enabled.

public final boolean
isEnabled(IonGenerator.Feature f)

Check whether specified generator feature is enabled.

public IonFactoryBuilder
rebuild()

Overrides com.fasterxml.jackson.core.JsonFactory.rebuild.

Method that allows construction of differently configured factory, starting with settings of this factory.

public void
public Version
version()

Overrides com.fasterxml.jackson.core.JsonFactory.version.

Implements com.fasterxml.jackson.core.Versioned.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).

Inherited from com.fasterxml.jackson.core.JsonFactory:
_checkInvalidCopy_copy_createContentReference_createContentReference_createContext_createContext_createGenerator_createNonBlockingContext_createParser_createUTF8Generator_createWriter_decorate_decorate_decorate_decorate_decorate_decorate_getBufferRecycler_getRecyclerPoolbuildercanParseAsynccanUseSchemaconfigureconfigureconfigurecreateGeneratorcreateGeneratorcreateGeneratorcreateJsonGeneratorcreateJsonGeneratorcreateJsonGeneratorcreateJsonParsercreateJsonParsercreateJsonParsercreateJsonParsercreateJsonParsercreateJsonParsercreateJsonParsercreateNonBlockingByteArrayParsercreateNonBlockingByteBufferParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParserdisabledisabledisableenableenableenablegetCharacterEscapesgetCodecgetFactoryFeaturesgetFormatReadFeatureTypegetFormatWriteFeatureTypegetGeneratorFeaturesgetInputDecoratorgetOutputDecoratorgetParserFeaturesgetRootValueSeparatorhasFormathasJSONFormatisEnabledisEnabledisEnabledisEnabledisEnabledreadResolverequiresCustomCodecrequiresPropertyOrderingsetCharacterEscapessetCodecsetErrorReportConfigurationsetInputDecoratorsetOutputDecoratorsetRecyclerPoolsetRootValueSeparatorsetStreamReadConstraintssetStreamWriteConstraintsstreamReadConstraintsstreamWriteConstraints

Field Detail

_cfgCreateBinaryWritersback to summary
protected boolean _cfgCreateBinaryWriters

Whether we will produce binary or text Ion writers: default is textual.

_ionGeneratorFeaturesback to summary
protected int _ionGeneratorFeatures
_ionParserFeaturesback to summary
protected int _ionParserFeatures
_systemback to summary
protected final IonSystem _system
DEFAULT_ION_GENERATOR_FEATURE_FLAGSback to summary
protected static final int DEFAULT_ION_GENERATOR_FEATURE_FLAGS

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

DEFAULT_ION_PARSER_FEATURE_FLAGSback to summary
protected static final int DEFAULT_ION_PARSER_FEATURE_FLAGS

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

FORMAT_NAME_IONback to summary
public static final String FORMAT_NAME_ION
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.core.JsonFactory.serialVersionUID.

Constructor Detail

IonFactoryback to summary
public IonFactory()
IonFactoryback to summary
public IonFactory(ObjectCodec mapper)
IonFactoryback to summary
public IonFactory(ObjectCodec mapper, IonSystem system)
IonFactoryback to summary
protected IonFactory(IonFactory src, ObjectCodec oc)
IonFactoryback to summary
protected IonFactory(IonFactoryBuilder b)

Constructors used by IonFactoryBuilder for instantiation.

Method Detail

_createGeneratorback to summary
protected IonGenerator _createGenerator(OutputStream out, JsonEncoding enc, boolean isManaged) throws IOException
_createGeneratorback to summary
protected IonGenerator _createGenerator(IonWriter ion, boolean ionWriterIsManaged, IOContext ctxt, Closeable dst)
_createParserback to summary
protected JsonParser _createParser(InputStream in, IOContext ctxt) throws IOException

Overrides com.fasterxml.jackson.core.JsonFactory._createParser.

Doc from com.fasterxml.jackson.core.JsonFactory._createParser.

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.

Parameters
in:InputStream

InputStream to use for reading content to parse

ctxt:IOContext

I/O context to use for parsing

Returns:JsonParser

Parser constructed

Annotations
@Override
Exceptions
IOException:
if parser initialization fails due to I/O (read) problem
_createParserback to summary
protected JsonParser _createParser(Reader r, IOContext ctxt) throws IOException

Overrides com.fasterxml.jackson.core.JsonFactory._createParser.

Doc from com.fasterxml.jackson.core.JsonFactory._createParser.

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.

Parameters
r:Reader

Reader to use for reading content to parse

ctxt:IOContext

I/O context to use for parsing

Returns:JsonParser

Actual parser to use

Annotations
@Override
Exceptions
IOException:
if parser initialization fails due to I/O (read) problem
_createParserback to summary
protected JsonParser _createParser(char[] data, int offset, int len, IOContext ctxt, boolean recyclable) throws IOException

Overrides com.fasterxml.jackson.core.JsonFactory._createParser.

Doc from com.fasterxml.jackson.core.JsonFactory._createParser.

Overridable factory method that actually instantiates parser using given char[] object for accessing content.

Parameters
data:char[]

Buffer that contains content to parse

offset:int

Offset to the first character of data to parse

len:int

Number of characters within buffer to parse

ctxt:IOContext

I/O context to use for parsing

recyclable:boolean

Whether input buffer is recycled by the factory

Returns:JsonParser

Actual parser to use

Annotations
@Override
Exceptions
IOException:
if parser initialization fails due to I/O (read) problem
_createParserback to summary
protected JsonParser _createParser(byte[] data, int offset, int len, IOContext ctxt) throws IOException

Overrides com.fasterxml.jackson.core.JsonFactory._createParser.

Doc from com.fasterxml.jackson.core.JsonFactory._createParser.

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.

Parameters
data:byte[]

Buffer that contains content to parse

offset:int

Offset to the first character of data to parse

len:int

Number of characters within buffer to parse

ctxt:IOContext

I/O context to use for parsing

Returns:JsonParser

Actual parser to use

Annotations
@Override
Exceptions
IOException:
if parser initialization fails due to I/O (read) problem
_readAllback to summary
protected String _readAll(Reader r, IOContext ctxt) throws IOException

Deprecated

Annotations
@Deprecated
builderForBinaryWritersback to summary
public static IonFactoryBuilder builderForBinaryWriters()

Method for creating IonFactoryBuilder initialized with settings to create binary (not textual) writers.

builderForTextualWritersback to summary
public static IonFactoryBuilder builderForTextualWriters()

Method for creating IonFactoryBuilder initialized with settings to create textual (not binary) writers.

canHandleBinaryNativelyback to summary
public boolean canHandleBinaryNatively()

Overrides com.fasterxml.jackson.core.JsonFactory.canHandleBinaryNatively.

Doc from com.fasterxml.jackson.core.JsonFactory.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.

Returns:boolean

Whether format supported by this factory supports native binary content

Annotations
@Override
canUseCharArraysback to summary
public boolean canUseCharArrays()

Overrides com.fasterxml.jackson.core.JsonFactory.canUseCharArrays.

Doc from com.fasterxml.jackson.core.JsonFactory.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 java.io.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 java.lang.String content by first copying it into recyclable intermediate buffer.

Returns:boolean

Whether access to decoded textual content can be efficiently accessed using parser method getTextCharacters().

Annotations
@Override
configureback to summary
public final IonFactory configure(IonParser.Feature f, boolean state)

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

configureback to summary
public final IonFactory configure(IonGenerator.Feature f, boolean state)

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

copyback to summary
public IonFactory copy()

Overrides com.fasterxml.jackson.core.JsonFactory.copy.

Doc from com.fasterxml.jackson.core.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.

Returns:IonFactory

Copy of this factory instance

Annotations
@Override
createBinaryWritersback to summary
public boolean createBinaryWriters()
createGeneratorback to summary
public JsonGenerator createGenerator(IonWriter out)
Since
2.7
createGeneratorback to summary
public JsonGenerator createGenerator(OutputStream out, JsonEncoding enc) throws IOException

Overrides com.fasterxml.jackson.core.JsonFactory.createGenerator.

Doc from com.fasterxml.jackson.core.JsonFactory.createGenerator.

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, com.fasterxml.jackson.core.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

OutputStream to use for writing JSON content

enc:JsonEncoding

Character encoding to use

Annotations
@Override
createGeneratorback to summary
public JsonGenerator createGenerator(Writer out) throws IOException

Overrides com.fasterxml.jackson.core.JsonFactory.createGenerator.

Doc from com.fasterxml.jackson.core.JsonFactory.createGenerator.

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, com.fasterxml.jackson.core.JsonGenerator.Feature#AUTO_CLOSE_TARGET is enabled). Using application needs to close it explicitly.

Parameters
out:Writer

Writer to use for writing JSON content

Annotations
@Override
createGeneratorback to summary
public JsonGenerator createGenerator(File f, JsonEncoding enc) throws IOException

Overrides com.fasterxml.jackson.core.JsonFactory.createGenerator.

Doc from com.fasterxml.jackson.core.JsonFactory.createGenerator.

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

File to write contents to

enc:JsonEncoding

Character encoding to use

Annotations
@Override
createJsonGeneratorback to summary
public JsonGenerator createJsonGenerator(IonWriter out)

Deprecated

Since 2.7

Annotations
@Deprecated
createJsonParserback to summary
public IonParser createJsonParser(IonReader in)

Deprecated

Since 2.7

Annotations
@Deprecated
createJsonParserback to summary
public IonParser createJsonParser(IonValue value)

Deprecated

Since 2.7

Annotations
@Deprecated
createParserback to summary
public IonParser createParser(IonReader in)
Since
2.7
createParserback to summary
public IonParser createParser(IonValue value)
Since
2.7
disableback to summary
public IonFactory disable(IonParser.Feature f)

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

disableback to summary
public IonFactory disable(IonGenerator.Feature f)

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

enableback to summary
public IonFactory enable(IonParser.Feature f)

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

enableback to summary
public IonFactory enable(IonGenerator.Feature f)

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

forBinaryWritersback to summary
public static IonFactory forBinaryWriters()

Method for creating IonFactory that will create binary (not textual) writers.

forTextualWritersback to summary
public static IonFactory forTextualWriters()

Method for creating IonFactory that will create textual (not binary) writers.

getFormatGeneratorFeaturesback to summary
public int getFormatGeneratorFeatures()

Overrides com.fasterxml.jackson.core.JsonFactory.getFormatGeneratorFeatures.

Annotations
@Override
getFormatNameback to summary
public String getFormatName()

Overrides com.fasterxml.jackson.core.JsonFactory.getFormatName.

Doc from com.fasterxml.jackson.core.JsonFactory.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

Returns:String

Name of the format handled by parsers, generators this factory creates

Annotations
@Override
getFormatParserFeaturesback to summary
public int getFormatParserFeatures()

Overrides com.fasterxml.jackson.core.JsonFactory.getFormatParserFeatures.

Annotations
@Override
getIonSystemback to summary
public IonSystem getIonSystem()
Since
2.12
isEnabledback to summary
public final boolean isEnabled(IonParser.Feature f)

Checked whether specified parser feature is enabled.

isEnabledback to summary
public final boolean isEnabled(IonGenerator.Feature f)

Check whether specified generator feature is enabled.

rebuildback to summary
public IonFactoryBuilder rebuild()

Overrides com.fasterxml.jackson.core.JsonFactory.rebuild.

Doc from com.fasterxml.jackson.core.JsonFactory.rebuild.

Method that allows construction of differently configured factory, starting with settings of this factory.

Returns:IonFactoryBuilder

Builder instance to use

Annotations
@Override
setCreateBinaryWritersback to summary
public void setCreateBinaryWriters(boolean b)
versionback to summary
public Version version()

Overrides com.fasterxml.jackson.core.JsonFactory.version.

Implements com.fasterxml.jackson.core.Versioned.version.

Doc from com.fasterxml.jackson.core.Versioned.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).

Returns:Version

Version of the component

Annotations
@Override