Top Description Fields Constructors Methods
tools.jackson.dataformat.ion

public Class IonFactory

extends DecorableTSFactory
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Annotations
@SuppressWarnings:resource
Imports
java.io.*, java.nio.file.Path, tools.jackson.core.*, tools.jackson.core.base.DecorableTSFactory, tools.jackson.core.io.IOContext, .ContentReference, .UTF8Writer, com.amazon.ion.IonReader, .IonSystem, .IonValue, .IonWriter, com.amazon.ion.system.IonSystemBuilder, .IonTextWriterBuilder

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

Field Summary

Modifier and TypeField and Description
protected final boolean
_cfgBinaryWriters

Whether we will produce binary (true) or textual (false) Ion writers.

protected final IonSystem
protected static final boolean
DEFAULT_CREATE_BINARY

Default setting for binary vs textual output: defaulting to textual.

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 tools.jackson.core.base.DecorableTSFactory:
_generatorDecorators_inputDecorator_outputDecorator

Constructor Summary

AccessConstructor and Description
public
protected
protected
IonFactory(IonFactoryBuilder b)

Constructors used by IonFactoryBuilder for instantiation.

Method Summary

Modifier and TypeMethod and Description
protected ContentReference
_createContentReference(Object contentRef)

Implements abstract tools.jackson.core.TokenStreamFactory._createContentReference.

Overridable factory method for constructing ContentReference to pass to parser or generator being created; used in cases where no offset or length is applicable (either irrelevant, or full contents assumed).

protected ContentReference
_createContentReference(Object contentRef, int offset, int length)

Implements abstract tools.jackson.core.TokenStreamFactory._createContentReference.

Overridable factory method for constructing ContentReference to pass to parser or generator being created; used in cases where input comes in a static buffer with relevant offset and length.

protected IonGenerator
_createGenerator(ObjectWriteContext writeCtxt, OutputStream out, JsonEncoding enc, boolean isManaged)

protected IonGenerator
_createGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, IonWriter ion, boolean ionWriterIsManaged, Closeable dst)

private JsonParser
private JsonParser
private JsonParser
_createParser(ObjectReadContext readCtxt, IOContext ioCtxt, char[] data, int offset, int len, boolean recyclable)

private JsonParser
_createParser(ObjectReadContext readCtxt, IOContext ioCtxt, byte[] data, int offset, int len)

protected IonWriter
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()

Implements abstract tools.jackson.core.TokenStreamFactory.canHandleBinaryNatively.

Introspection method that higher-level functionality may call to see whether underlying data format can read and write binary data natively; that is, embedded it as-is without using encodings such as Base64.

public boolean
canParseAsync()

Implements abstract tools.jackson.core.TokenStreamFactory.canParseAsync.

Introspection method that can be used to check whether this factory can create non-blocking parsers: parsers that do not use blocking I/O abstractions but instead use a tools.jackson.core.async.NonBlockingInputFeeder.

public boolean
canUseSchema(FormatSchema schema)

Implements abstract tools.jackson.core.TokenStreamFactory.canUseSchema.

Method that can be used to quickly check whether given schema is something that parsers and/or generators constructed by this factory could use.

public IonFactory
copy()

Implements abstract tools.jackson.core.TokenStreamFactory.copy.

Method similar to snapshot(), but one that forces creation of actual new copy that does NOT share any state, even non-visible to calling code, such as symbol table reuse.

public JsonGenerator
createGenerator(ObjectWriteContext writeCtxt, OutputStream out, JsonEncoding enc)

Implements abstract tools.jackson.core.TokenStreamFactory.createGenerator.

Method for constructing generator that writes contents using specified OutputStream with specified textual encoding (if applicable).

public JsonGenerator
createGenerator(ObjectWriteContext writeCtxt, Writer w)

Implements abstract tools.jackson.core.TokenStreamFactory.createGenerator.

Method for constructing generator that writes contents using specified Writer.

public JsonGenerator
createGenerator(ObjectWriteContext writeCtxt, File f, JsonEncoding enc)

Implements abstract tools.jackson.core.TokenStreamFactory.createGenerator.

Method for constructing generator that writes contents to specified file, overwriting contents it might have (or creating it if such file does not yet exist).

public JsonGenerator
createGenerator(ObjectWriteContext writeCtxt, Path p, JsonEncoding enc)

Implements abstract tools.jackson.core.TokenStreamFactory.createGenerator.

Method for constructing generator that writes contents to specified path, overwriting contents it might have (or creating it if such path does not yet exist).

public IonGenerator
public JsonParser
createParser(ObjectReadContext readCtxt, File f)

Implements abstract tools.jackson.core.TokenStreamFactory.createParser.

Method for constructing parser instance to decode contents of specified file.

public JsonParser
createParser(ObjectReadContext readCtxt, Path p)

Implements abstract tools.jackson.core.TokenStreamFactory.createParser.

Method for constructing parser instance to decode contents of specified path.

public JsonParser
createParser(ObjectReadContext readCtxt, InputStream in)

Implements abstract tools.jackson.core.TokenStreamFactory.createParser.

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

public JsonParser
createParser(ObjectReadContext readCtxt, Reader r)

Implements abstract tools.jackson.core.TokenStreamFactory.createParser.

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

public JsonParser
createParser(ObjectReadContext readCtxt, byte[] data)

Overrides tools.jackson.core.TokenStreamFactory.createParser.

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

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

Implements abstract tools.jackson.core.TokenStreamFactory.createParser.

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

public JsonParser
createParser(ObjectReadContext readCtxt, String content)

Implements abstract tools.jackson.core.TokenStreamFactory.createParser.

Method for constructing parser for parsing contents of given String.

public JsonParser
createParser(ObjectReadContext readCtxt, char[] content, int offset, int len)

Implements abstract tools.jackson.core.TokenStreamFactory.createParser.

Method for constructing parser for parsing contents of given char array.

public JsonParser
createParser(ObjectReadContext readCtxt, DataInput in)

Implements abstract tools.jackson.core.TokenStreamFactory.createParser.

Optional method for constructing parser for reading contents from specified DataInput instance.

public IonParser
public IonParser
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 String
getFormatName()

Implements abstract tools.jackson.core.TokenStreamFactory.getFormatName.

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

public Class<IonReadFeature>
getFormatReadFeatureType()

Overrides tools.jackson.core.TokenStreamFactory.getFormatReadFeatureType.

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

public Class<IonWriteFeature>
getFormatWriteFeatureType()

Overrides tools.jackson.core.TokenStreamFactory.getFormatWriteFeatureType.

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

public IonSystem
public final boolean
isEnabled(IonReadFeature f)

Checked whether specified parser feature is enabled.

public final boolean
isEnabled(IonWriteFeature f)

Check whether specified generator feature is enabled.

protected Object
readResolve()

Method that we need to override to actually make restoration go through constructors etc.

public IonFactoryBuilder
rebuild()

Implements abstract tools.jackson.core.TokenStreamFactory.rebuild.

Method that can be used to create differently configured stream factories: it will create and return a Builder instance with exact settings of this stream factory.

public TokenStreamFactory
snapshot()

Implements abstract tools.jackson.core.TokenStreamFactory.snapshot.

Implements tools.jackson.core.util.Snapshottable.snapshot.

Instances are immutable so just return `this`

public Version
version()

Implements abstract tools.jackson.core.TokenStreamFactory.version.

Implements tools.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 tools.jackson.core.base.DecorableTSFactory:
_copy_decorate_decorate_decorate_decorate_decorate_decorategetGeneratorDecoratorsgetInputDecoratorgetOutputDecorator

Field Detail

_cfgBinaryWritersback to summary
protected final boolean _cfgBinaryWriters

Whether we will produce binary (true) or textual (false) Ion writers.

_systemback to summary
protected final IonSystem _system
DEFAULT_CREATE_BINARYback to summary
protected static final boolean DEFAULT_CREATE_BINARY

Default setting for binary vs textual output: defaulting to textual.

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 tools.jackson.core.base.DecorableTSFactory.serialVersionUID.

Constructor Detail

IonFactoryback to summary
public IonFactory()
IonFactoryback to summary
protected IonFactory(IonFactory src)
IonFactoryback to summary
protected IonFactory(IonFactoryBuilder b)

Constructors used by IonFactoryBuilder for instantiation.

Since
3.0

Method Detail

_createContentReferenceback to summary
protected ContentReference _createContentReference(Object contentRef)

Implements abstract tools.jackson.core.TokenStreamFactory._createContentReference.

Doc from tools.jackson.core.TokenStreamFactory._createContentReference.

Overridable factory method for constructing ContentReference to pass to parser or generator being created; used in cases where no offset or length is applicable (either irrelevant, or full contents assumed).

Annotations
@Override
_createContentReferenceback to summary
protected ContentReference _createContentReference(Object contentRef, int offset, int length)

Implements abstract tools.jackson.core.TokenStreamFactory._createContentReference.

Doc from tools.jackson.core.TokenStreamFactory._createContentReference.

Overridable factory method for constructing ContentReference to pass to parser or generator being created; used in cases where input comes in a static buffer with relevant offset and length.

Annotations
@Override
_createGeneratorback to summary
protected IonGenerator _createGenerator(ObjectWriteContext writeCtxt, OutputStream out, JsonEncoding enc, boolean isManaged)
_createGeneratorback to summary
protected IonGenerator _createGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, IonWriter ion, boolean ionWriterIsManaged, Closeable dst)
_createParserback to summary
private JsonParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, InputStream in)
_createParserback to summary
private JsonParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, Reader r)
_createParserback to summary
private JsonParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, char[] data, int offset, int len, boolean recyclable)
_createParserback to summary
private JsonParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, byte[] data, int offset, int len)
_createTextualIonWriterback to summary
protected IonWriter _createTextualIonWriter(ObjectWriteContext writeCtxt, Writer w)
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()

Implements abstract tools.jackson.core.TokenStreamFactory.canHandleBinaryNatively.

Doc from tools.jackson.core.TokenStreamFactory.canHandleBinaryNatively.

Introspection method that higher-level functionality may call to see whether underlying data format can read and write binary data natively; that is, embedded it as-is without using encodings such as Base64.

Annotations
@Override
canParseAsyncback to summary
public boolean canParseAsync()

Implements abstract tools.jackson.core.TokenStreamFactory.canParseAsync.

Doc from tools.jackson.core.TokenStreamFactory.canParseAsync.

Introspection method that can be used to check whether this factory can create non-blocking parsers: parsers that do not use blocking I/O abstractions but instead use a tools.jackson.core.async.NonBlockingInputFeeder.

Annotations
@Override
canUseSchemaback to summary
public boolean canUseSchema(FormatSchema schema)

Implements abstract tools.jackson.core.TokenStreamFactory.canUseSchema.

Doc from tools.jackson.core.TokenStreamFactory.canUseSchema.

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.

Annotations
@Override
copyback to summary
public IonFactory copy()

Implements abstract tools.jackson.core.TokenStreamFactory.copy.

Doc from tools.jackson.core.TokenStreamFactory.copy.

Method similar to snapshot(), but one that forces creation of actual new copy that does NOT share any state, even non-visible to calling code, such as symbol table reuse.

Implementation should be functionally equivalent to:

    factoryInstance.rebuild().build();
Annotations
@Override
createGeneratorback to summary
public JsonGenerator createGenerator(ObjectWriteContext writeCtxt, OutputStream out, JsonEncoding enc)

Implements abstract tools.jackson.core.TokenStreamFactory.createGenerator.

Doc from tools.jackson.core.TokenStreamFactory.createGenerator.

Method for constructing generator that writes contents using specified OutputStream with specified textual encoding (if applicable).

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, tools.jackson.core.StreamWriteFeature#AUTO_CLOSE_TARGET is enabled). Using application needs to close it explicitly if this is the case.

Annotations
@Override
createGeneratorback to summary
public JsonGenerator createGenerator(ObjectWriteContext writeCtxt, Writer w)

Implements abstract tools.jackson.core.TokenStreamFactory.createGenerator.

Doc from tools.jackson.core.TokenStreamFactory.createGenerator.

Method for constructing generator that writes contents using specified Writer. Textual encoding used will be UTF-8, where applicable.

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

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

Implements abstract tools.jackson.core.TokenStreamFactory.createGenerator.

Doc from tools.jackson.core.TokenStreamFactory.createGenerator.

Method for constructing generator that writes contents to specified file, overwriting contents it might have (or creating it if such file does not yet exist).

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

Annotations
@Override
createGeneratorback to summary
public JsonGenerator createGenerator(ObjectWriteContext writeCtxt, Path p, JsonEncoding enc) throws JacksonException

Implements abstract tools.jackson.core.TokenStreamFactory.createGenerator.

Doc from tools.jackson.core.TokenStreamFactory.createGenerator.

Method for constructing generator that writes contents to specified path, overwriting contents it might have (or creating it if such path does not yet exist).

Underlying stream is owned by the generator constructed, i.e. generator will handle closing of path when JsonGenerator#close is called.

Annotations
@Override
Exceptions
JacksonException:
If generator construction or initialization fails
createGeneratorback to summary
public IonGenerator createGenerator(ObjectWriteContext writeCtxt, IonWriter out)
createParserback to summary
public JsonParser createParser(ObjectReadContext readCtxt, File f)

Implements abstract tools.jackson.core.TokenStreamFactory.createParser.

Doc from tools.jackson.core.TokenStreamFactory.createParser.

Method for constructing parser instance to decode 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.

Annotations
@Override
createParserback to summary
public JsonParser createParser(ObjectReadContext readCtxt, Path p) throws JacksonException

Implements abstract tools.jackson.core.TokenStreamFactory.createParser.

Doc from tools.jackson.core.TokenStreamFactory.createParser.

Method for constructing parser instance to decode contents of specified path.

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.

Annotations
@Override
Exceptions
JacksonException:
If parser construction or initialization fails
createParserback to summary
public JsonParser createParser(ObjectReadContext readCtxt, InputStream in)

Implements abstract tools.jackson.core.TokenStreamFactory.createParser.

Doc from tools.jackson.core.TokenStreamFactory.createParser.

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) tools.jackson.core.StreamReadFeature#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).

Annotations
@Override
createParserback to summary
public JsonParser createParser(ObjectReadContext readCtxt, Reader r)

Implements abstract tools.jackson.core.TokenStreamFactory.createParser.

Doc from tools.jackson.core.TokenStreamFactory.createParser.

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) tools.jackson.core.StreamReadFeature#AUTO_CLOSE_SOURCE is enabled.

Annotations
@Override
createParserback to summary
public JsonParser createParser(ObjectReadContext readCtxt, byte[] data)

Overrides tools.jackson.core.TokenStreamFactory.createParser.

Doc from tools.jackson.core.TokenStreamFactory.createParser.

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

Annotations
@Override
createParserback to summary
public JsonParser createParser(ObjectReadContext readCtxt, byte[] data, int offset, int len)

Implements abstract tools.jackson.core.TokenStreamFactory.createParser.

Doc from tools.jackson.core.TokenStreamFactory.createParser.

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

Annotations
@Override
createParserback to summary
public JsonParser createParser(ObjectReadContext readCtxt, String content)

Implements abstract tools.jackson.core.TokenStreamFactory.createParser.

Doc from tools.jackson.core.TokenStreamFactory.createParser.

Method for constructing parser for parsing contents of given String.

Annotations
@Override
createParserback to summary
public JsonParser createParser(ObjectReadContext readCtxt, char[] content, int offset, int len)

Implements abstract tools.jackson.core.TokenStreamFactory.createParser.

Doc from tools.jackson.core.TokenStreamFactory.createParser.

Method for constructing parser for parsing contents of given char array.

Annotations
@Override
createParserback to summary
public JsonParser createParser(ObjectReadContext readCtxt, DataInput in)

Implements abstract tools.jackson.core.TokenStreamFactory.createParser.

Doc from tools.jackson.core.TokenStreamFactory.createParser.

Optional method for constructing parser for reading contents from specified DataInput instance.

If this factory does not support DataInput as source, will throw UnsupportedOperationException

Annotations
@Override
createParserback to summary
public IonParser createParser(ObjectReadContext readCtxt, IonReader in)
createParserback to summary
public IonParser createParser(ObjectReadContext readCtxt, IonValue value)
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.

getFormatNameback to summary
public String getFormatName()

Implements abstract tools.jackson.core.TokenStreamFactory.getFormatName.

Doc from tools.jackson.core.TokenStreamFactory.getFormatName.

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

Annotations
@Override
getFormatReadFeatureTypeback to summary
public Class<IonReadFeature> getFormatReadFeatureType()

Overrides tools.jackson.core.TokenStreamFactory.getFormatReadFeatureType.

Doc from tools.jackson.core.TokenStreamFactory.getFormatReadFeatureType.

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

Annotations
@Override
getFormatWriteFeatureTypeback to summary
public Class<IonWriteFeature> getFormatWriteFeatureType()

Overrides tools.jackson.core.TokenStreamFactory.getFormatWriteFeatureType.

Doc from tools.jackson.core.TokenStreamFactory.getFormatWriteFeatureType.

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

Annotations
@Override
getIonSystemback to summary
public IonSystem getIonSystem()
isEnabledback to summary
public final boolean isEnabled(IonReadFeature f)

Checked whether specified parser feature is enabled.

isEnabledback to summary
public final boolean isEnabled(IonWriteFeature f)

Check whether specified generator feature is enabled.

readResolveback to summary
protected Object readResolve()

Method that we need to override to actually make restoration go through constructors etc.

rebuildback to summary
public IonFactoryBuilder rebuild()

Implements abstract tools.jackson.core.TokenStreamFactory.rebuild.

Doc from tools.jackson.core.TokenStreamFactory.rebuild.

Method that can be used to create differently configured stream factories: it will create and return a Builder instance with exact settings of this stream factory.

Annotations
@Override
snapshotback to summary
public TokenStreamFactory snapshot()

Implements abstract tools.jackson.core.TokenStreamFactory.snapshot.

Implements tools.jackson.core.util.Snapshottable.snapshot.

Instances are immutable so just return `this`

Annotations
@Override
versionback to summary
public Version version()

Implements abstract tools.jackson.core.TokenStreamFactory.version.

Implements tools.jackson.core.Versioned.version.

Doc from tools.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).

Annotations
@Override