Top Description Fields Constructors Methods
tools.jackson.core.base

public abstract Class TextualTSFactory

extends DecorableTSFactory
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
tools.jackson.core.json.JsonFactory
Annotations
@SuppressWarnings:resource
Imports
java.io.*, java.nio.file.Path, tools.jackson.core.*, tools.jackson.core.io.ContentReference, .IOContext, .UTF8Writer

Intermediate TokenStreamFactory sub-class used as the base for textual data formats.

Field Summary

Modifier and TypeField and Description
private static final long
Inherited from tools.jackson.core.base.DecorableTSFactory:
_generatorDecorators_inputDecorator_outputDecorator

Constructor Summary

AccessConstructor and Description
protected
protected
TextualTSFactory(DecorableTSFactory.DecorableTSFBuilder<?, ?>
Builder with configurations to use
baseBuilder
)

Constructors used by builders for instantiation.

protected

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 abstract JsonGenerator

Returns:

Generator constructed
_createGenerator
(ObjectWriteContext
Object write context for generator to use
writeCtxt
,
IOContext
IOContext for generator to use
ioCtxt
,
Writer
Writer for generator to use
out
)

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

protected abstract JsonParser
protected abstract JsonParser
protected abstract JsonParser
_createParser(ObjectReadContext readCtxt, IOContext ctxt, byte[] data, int offset, int len)

protected abstract JsonParser
_createParser(ObjectReadContext readCtxt, IOContext ctxt, char[] data, int offset, int len, boolean recyclable)

protected abstract JsonParser
protected abstract JsonGenerator

Returns:

Generator constructed
_createUTF8Generator
(ObjectWriteContext
Object write context for generator to use
writeCtxt
,
IOContext
IOContext for generator to use
ioCtxt
,
OutputStream
OutputStream for generator to use
out
)

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

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

Returns:

Whether efficient access is possible
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 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 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, 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.

Inherited from tools.jackson.core.base.DecorableTSFactory:
_copy_decorate_decorate_decorate_decorate_decorate_decorategetGeneratorDecoratorsgetInputDecoratorgetOutputDecorator

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides tools.jackson.core.base.DecorableTSFactory.serialVersionUID.

Constructor Detail

TextualTSFactoryback to summary
protected TextualTSFactory(StreamReadConstraints src, StreamWriteConstraints swc, ErrorReportConfiguration erc, int formatPF, int formatGF)
TextualTSFactoryback to summary
protected TextualTSFactory(DecorableTSFactory.DecorableTSFBuilder<?, ?> baseBuilder)

Constructors used by builders for instantiation.

Parameters
baseBuilder:DecorableTSFactory.DecorableTSFBuilder<?, ?>

Builder with configurations to use

Since
3.0
TextualTSFactoryback to summary
protected TextualTSFactory(TextualTSFactory src)

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 abstract JsonGenerator _createGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, Writer out) throws JacksonException

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.

Parameters
writeCtxt:ObjectWriteContext

Object write context for generator to use

ioCtxt:IOContext

IOContext for generator to use

out:Writer

Writer for generator to use

Returns:JsonGenerator

Generator constructed

Exceptions
JacksonException:
If there is a problem constructing generator
_createParserback to summary
protected abstract JsonParser _createParser(ObjectReadContext readCtxt, IOContext ctxt, InputStream in) throws JacksonException
_createParserback to summary
protected abstract JsonParser _createParser(ObjectReadContext readCtxt, IOContext ctxt, Reader r) throws JacksonException
_createParserback to summary
protected abstract JsonParser _createParser(ObjectReadContext readCtxt, IOContext ctxt, byte[] data, int offset, int len) throws JacksonException
_createParserback to summary
protected abstract JsonParser _createParser(ObjectReadContext readCtxt, IOContext ctxt, char[] data, int offset, int len, boolean recyclable) throws JacksonException
_createParserback to summary
protected abstract JsonParser _createParser(ObjectReadContext readCtxt, IOContext ctxt, DataInput input) throws JacksonException
_createUTF8Generatorback to summary
protected abstract JsonGenerator _createUTF8Generator(ObjectWriteContext writeCtxt, IOContext ioCtxt, OutputStream out) throws JacksonException

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.

Parameters
writeCtxt:ObjectWriteContext

Object write context for generator to use

ioCtxt:IOContext

IOContext for generator to use

out:OutputStream

OutputStream for generator to use

Returns:JsonGenerator

Generator constructed

Exceptions
JacksonException:
If there is a problem constructing generator
_createWriterback to summary
protected Writer _createWriter(IOContext ioCtxt, OutputStream out, JsonEncoding enc) throws JacksonException
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
canUseCharArraysback to summary
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 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.

Default implementation simply returns true

Returns:boolean

Whether efficient access is possible

createGeneratorback to summary
public JsonGenerator createGenerator(ObjectWriteContext writeCtxt, OutputStream out, 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 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
Exceptions
JacksonException:
If generator construction or initialization fails
createGeneratorback to summary
public JsonGenerator createGenerator(ObjectWriteContext writeCtxt, Writer w) throws JacksonException

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
Exceptions
JacksonException:
If generator construction or initialization fails
createGeneratorback to summary
public JsonGenerator createGenerator(ObjectWriteContext writeCtxt, File f, 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 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
Exceptions
JacksonException:
If generator construction or initialization fails
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
createParserback to summary
public JsonParser createParser(ObjectReadContext readCtxt, File f) 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 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
Exceptions
JacksonException:
If parser construction or initialization fails
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) throws JacksonException

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
Exceptions
JacksonException:
If parser construction or initialization fails
createParserback to summary
public JsonParser createParser(ObjectReadContext readCtxt, Reader r) throws JacksonException

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
Exceptions
JacksonException:
If parser construction or initialization fails
createParserback to summary
public JsonParser createParser(ObjectReadContext readCtxt, byte[] data, int offset, int len) throws JacksonException

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
Exceptions
JacksonException:
If parser construction or initialization fails
createParserback to summary
public JsonParser createParser(ObjectReadContext readCtxt, String content) throws JacksonException

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
Exceptions
JacksonException:
If parser construction or initialization fails
createParserback to summary
public JsonParser createParser(ObjectReadContext readCtxt, char[] content, int offset, int len) throws JacksonException

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
Exceptions
JacksonException:
If parser construction or initialization fails
createParserback to summary
public JsonParser createParser(ObjectReadContext readCtxt, DataInput in) throws JacksonException

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
Exceptions
JacksonException:
If parser construction or initialization fails