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

public abstract Class BinaryTSFactory

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.io.ContentReference, .IOContext

Intermediate TokenStreamFactory sub-class used as the base for binary (non-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
BinaryTSFactory(DecorableTSFactory.DecorableTSFBuilder<?, ?>
Builder with configurations to use
baseBuilder
)

Constructor 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
,
OutputStream
Writer for generator to use
out
)

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

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

protected abstract JsonParser
protected <T> T
protected <T> T
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 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

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

Constructor used by builders for instantiation.

Parameters
baseBuilder:DecorableTSFactory.DecorableTSFBuilder<?, ?>

Builder with configurations to use

Since
3.0
BinaryTSFactoryback to summary
protected BinaryTSFactory(BinaryTSFactory 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, 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

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 ioCtxt, InputStream in) throws JacksonException
_createParserback to summary
protected abstract JsonParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, byte[] data, int offset, int len) throws JacksonException
_createParserback to summary
protected abstract JsonParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, DataInput input) throws JacksonException
_nonByteSourceback to summary
protected <T> T _nonByteSource() throws JacksonException
_nonByteTargetback to summary
protected <T> T _nonByteTarget() 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
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