public abstract class TokenStreamFactory extends Object implements Versioned, Serializable
Constructor and Description |
---|
TokenStreamFactory() |
Modifier and Type | Method and Description |
---|---|
protected void |
_checkRangeBoundsForByteArray(byte[] data,
int offset,
int len) |
protected void |
_checkRangeBoundsForCharArray(char[] data,
int offset,
int len) |
protected OutputStream |
_createDataOutputWrapper(DataOutput out) |
protected InputStream |
_fileInputStream(File f)
Helper methods used for constructing an
InputStream for
parsers to use, when input is to be read from given File . |
protected OutputStream |
_fileOutputStream(File f)
Helper methods used for constructing an
OutputStream for
generator to use, when target is to be written into given File . |
protected InputStream |
_optimizedStreamFromURL(URL url)
Helper method used for constructing an optimal stream for
parsers to use, when input is to be read from an URL.
|
protected <T> T |
_reportRangeError(String msg) |
abstract boolean |
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.
|
abstract boolean |
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
NonBlockingInputFeeder . |
abstract boolean |
canUseSchema(FormatSchema schema)
Method that can be used to quickly check whether given schema
is something that parsers and/or generators constructed by this
factory could use.
|
abstract JsonGenerator |
createGenerator(DataOutput out) |
abstract JsonGenerator |
createGenerator(DataOutput out,
JsonEncoding enc) |
abstract JsonGenerator |
createGenerator(File f,
JsonEncoding enc) |
abstract JsonGenerator |
createGenerator(OutputStream out) |
abstract JsonGenerator |
createGenerator(OutputStream out,
JsonEncoding enc) |
abstract JsonGenerator |
createGenerator(Writer w) |
abstract JsonParser |
createNonBlockingByteArrayParser()
Optional method for constructing parser for non-blocking parsing
via
ByteArrayFeeder
interface (accessed using JsonParser.getNonBlockingInputFeeder()
from constructed instance). |
abstract JsonParser |
createNonBlockingByteBufferParser()
Optional method for constructing parser for non-blocking parsing
via
ByteBufferFeeder
interface (accessed using JsonParser.getNonBlockingInputFeeder()
from constructed instance). |
abstract JsonParser |
createParser(byte[] data) |
abstract JsonParser |
createParser(byte[] data,
int offset,
int len) |
abstract JsonParser |
createParser(char[] content) |
abstract JsonParser |
createParser(char[] content,
int offset,
int len) |
abstract JsonParser |
createParser(DataInput in) |
abstract JsonParser |
createParser(File f) |
abstract JsonParser |
createParser(InputStream in) |
abstract JsonParser |
createParser(Reader r) |
abstract JsonParser |
createParser(String content) |
abstract JsonParser |
createParser(URL url) |
abstract int |
getFormatGeneratorFeatures() |
abstract String |
getFormatName()
Method that returns short textual id identifying format
this factory supports.
|
abstract int |
getFormatParserFeatures() |
abstract Class<? extends FormatFeature> |
getFormatReadFeatureType()
Method for accessing kind of
FormatFeature that a parser
JsonParser produced by this factory would accept, if any;
null returned if none. |
abstract Class<? extends FormatFeature> |
getFormatWriteFeatureType()
Method for accessing kind of
FormatFeature that a parser
JsonGenerator produced by this factory would accept, if any;
null returned if none. |
abstract int |
getGeneratorFeatures() |
abstract int |
getParserFeatures() |
abstract boolean |
isEnabled(JsonGenerator.Feature f) |
abstract boolean |
isEnabled(JsonParser.Feature f) |
abstract boolean |
requiresPropertyOrdering()
Introspection method that higher-level functionality may call
to see whether underlying data format requires a stable ordering
of object properties or not.
|
abstract StreamReadConstraints |
streamReadConstraints()
Get the constraints to apply when performing streaming reads.
|
public abstract boolean requiresPropertyOrdering()
Default implementation returns false
as JSON does NOT
require stable ordering. Formats that require ordering include positional
textual formats like CSV
, and schema-based binary formats
like Avro
.
public abstract boolean canHandleBinaryNatively()
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.
public abstract boolean canParseAsync()
NonBlockingInputFeeder
.createNonBlockingXxx()
method(s) work)public abstract Class<? extends FormatFeature> getFormatReadFeatureType()
FormatFeature
that a parser
JsonParser
produced by this factory would accept, if any;
null
returned if none.null
if nonepublic abstract Class<? extends FormatFeature> getFormatWriteFeatureType()
FormatFeature
that a parser
JsonGenerator
produced by this factory would accept, if any;
null
returned if none.null
if nonepublic abstract boolean canUseSchema(FormatSchema schema)
schema
- Schema instance to checkpublic abstract String getFormatName()
public abstract boolean isEnabled(JsonParser.Feature f)
public abstract boolean isEnabled(JsonGenerator.Feature f)
public abstract int getParserFeatures()
public abstract int getGeneratorFeatures()
public abstract int getFormatParserFeatures()
public abstract int getFormatGeneratorFeatures()
public abstract StreamReadConstraints streamReadConstraints()
JsonParser
s constructed
by this factory.public abstract JsonParser createParser(byte[] data) throws IOException
IOException
public abstract JsonParser createParser(byte[] data, int offset, int len) throws IOException
IOException
public abstract JsonParser createParser(char[] content) throws IOException
IOException
public abstract JsonParser createParser(char[] content, int offset, int len) throws IOException
IOException
public abstract JsonParser createParser(DataInput in) throws IOException
IOException
public abstract JsonParser createParser(File f) throws IOException
IOException
public abstract JsonParser createParser(InputStream in) throws IOException
IOException
public abstract JsonParser createParser(Reader r) throws IOException
IOException
public abstract JsonParser createParser(String content) throws IOException
IOException
public abstract JsonParser createParser(URL url) throws IOException
IOException
public abstract JsonParser createNonBlockingByteArrayParser() throws IOException
ByteArrayFeeder
interface (accessed using JsonParser.getNonBlockingInputFeeder()
from constructed instance).
If this factory does not support non-blocking parsing (either at all,
or from byte array),
will throw UnsupportedOperationException
.
Note that JSON-backed factory only supports parsing of UTF-8 encoded JSON content (and US-ASCII since it is proper subset); other encodings are not supported at this point.
IOException
public abstract JsonParser createNonBlockingByteBufferParser() throws IOException
ByteBufferFeeder
interface (accessed using JsonParser.getNonBlockingInputFeeder()
from constructed instance).
If this factory does not support non-blocking parsing (either at all,
or from byte array),
will throw UnsupportedOperationException
.
Note that JSON-backed factory only supports parsing of UTF-8 encoded JSON content (and US-ASCII since it is proper subset); other encodings are not supported at this point.
IOException
public abstract JsonGenerator createGenerator(DataOutput out, JsonEncoding enc) throws IOException
IOException
public abstract JsonGenerator createGenerator(DataOutput out) throws IOException
IOException
public abstract JsonGenerator createGenerator(File f, JsonEncoding enc) throws IOException
IOException
public abstract JsonGenerator createGenerator(OutputStream out) throws IOException
IOException
public abstract JsonGenerator createGenerator(OutputStream out, JsonEncoding enc) throws IOException
IOException
public abstract JsonGenerator createGenerator(Writer w) throws IOException
IOException
protected OutputStream _createDataOutputWrapper(DataOutput out)
protected InputStream _optimizedStreamFromURL(URL url) throws IOException
url
- Source to read content to parse fromURL
IOException
- If there is a problem accessing content from specified URL
protected InputStream _fileInputStream(File f) throws IOException
InputStream
for
parsers to use, when input is to be read from given File
.f
- File to open stream forInputStream
constructedIOException
- If there is a problem opening the streamprotected OutputStream _fileOutputStream(File f) throws IOException
OutputStream
for
generator to use, when target is to be written into given File
.f
- File to open stream forOutputStream
constructedIOException
- If there is a problem opening the streamprotected void _checkRangeBoundsForByteArray(byte[] data, int offset, int len) throws IllegalArgumentException
IllegalArgumentException
protected void _checkRangeBoundsForCharArray(char[] data, int offset, int len) throws IOException
IOException
protected <T> T _reportRangeError(String msg) throws IllegalArgumentException
IllegalArgumentException
Copyright © 2008–2024 FasterXML. All rights reserved.