JsonFactory implementation for encoding/decoding Avro
content, uses native Jackson encoder/decoder.
com.fasterxml.jackson.dataformat.avro.apacheimpl.ApacheAvroFactory
| Modifier and Type | Field and Description |
|---|---|
| protected int | |
| protected int | |
| protected RecyclerPool | |
| protected boolean | _useApacheLibDecoder
Flag that is set if Apache Avro lib's decoder is to be used for decoding; `false` to use Jackson native Avro decoder. |
| pack-priv static final int | DEFAULT_AVRO_GENERATOR_FEATURE_FLAGS
Bitfield (set of flags) of all generator features that are enabled by default. |
| pack-priv static final int | DEFAULT_AVRO_PARSER_FEATURE_FLAGS
Bitfield (set of flags) of all parser features that are enabled by default. |
| public static final String | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| protected | |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected JsonGenerator | _createGenerator(Writer
Writer underlying writer to write generated content to out, IOContext I/O context to use ctxt)Overrides com. Overridable factory method that actually instantiates desired generator. |
| protected AvroGenerator | |
| protected AvroParser | _createParser(InputStream
InputStream to use for reading content to parse in, IOContext I/O context to use for parsing ctxt)Overrides com. Overridable factory method that actually instantiates desired parser. |
| protected JsonParser | _createParser(Reader
Reader to use for reading content to parse r, IOContext I/O context to use for parsing ctxt)Overrides com. Overridable factory method that actually instantiates parser
using given |
| 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. Overridable factory method that actually instantiates parser
using given |
| protected AvroParser | _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. Overridable factory method that actually instantiates parser
using given |
| protected Writer | _createWriter(OutputStream out, JsonEncoding enc, IOContext ctxt)
Overrides com.
|
| protected <T> T | |
| protected <T> T | |
| public static AvroFactoryBuilder | builder()
Hides com. Main factory method to use for constructing a builder for creating
|
| public static AvroFactoryBuilder | builderWithApacheDecoder()
Main factory method to use for constructing a builder for creating
|
| public static AvroFactoryBuilder | builderWithNativeDecoder()
Main factory method to use for constructing a builder for creating
|
| public boolean | canHandleBinaryNatively()
Overrides com. 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 | canUseSchema(FormatSchema
Schema instance to check schema)Overrides com. 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 final AvroFactory | configure(AvroParser.
Method for enabling or disabling specified parser feature
(check |
| public final AvroFactory | configure(AvroGenerator.
Method for enabling or disabling specified generator feature
(check |
| public AvroFactory | copy()
Overrides com. Method for constructing a new |
| public AvroGenerator | createGenerator(OutputStream
OutputStream to use for writing JSON content out, JsonEncoding Character encoding to use enc)Overrides com. Note co-variant return type |
| public AvroGenerator | createGenerator(OutputStream out)
Overrides com. Since Avro format always uses UTF-8 internally, no encoding need to be passed to this method. |
| public AvroParser | createParser(File
File that contains JSON content to parse f)Overrides com. Method for constructing JSON parser instance to parse contents of specified file. |
| public AvroParser | createParser(URL
URL pointing to resource that contains JSON content to parse url)Overrides com. Method for constructing JSON parser instance to parse contents of resource reference by given URL. |
| public AvroParser | createParser(InputStream
InputStream to use for reading JSON content to parse in)Overrides com. Method for constructing JSON parser instance to parse the contents accessed via specified input stream. |
| public AvroParser | createParser(byte[] data)
Overrides com. Method for constructing parser for parsing the contents of given byte array. |
| public AvroParser | createParser(byte[]
Buffer that contains data to parse data, int Offset of the first data byte within buffer offset, int Length of contents to parse within buffer len)Overrides com. Method for constructing parser for parsing the contents of given byte array. |
| public AvroFactory | disable(AvroParser.
Method for disabling specified parser features
(check |
| public AvroFactory | disable(AvroGenerator.
Method for disabling specified generator feature
(check |
| public AvroFactory | enable(AvroParser.
Method for enabling specified parser feature
(check |
| public AvroFactory | enable(AvroGenerator.
Method for enabling specified generator features
(check |
| public int | |
| public String | getFormatName()
Overrides com. Method that returns short textual id identifying format this factory supports. |
| public int | |
| public MatchStrength | hasFormat(InputAccessor acc)
Overrides com. Sub-classes need to override this method |
| public final boolean | |
| public final boolean | |
| protected Object | readResolve()
Overrides com. Method that we need to override to actually make restoration go through constructors etc. Also: must be overridden by sub-classes as well. |
| public AvroFactoryBuilder | rebuild()
Overrides com. Method that allows construction of differently configured factory, starting with settings of this factory. |
| public boolean | requiresPropertyOrdering()
Overrides com. Introspection method that higher-level functionality may call to see whether underlying data format requires a stable ordering of object properties or not. |
| public Version | version()
Overrides com. Implements com. 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 |
| _avroGeneratorFeatures | back to summary |
|---|---|
| protected int _avroGeneratorFeatures | |
| _avroParserFeatures | back to summary |
|---|---|
| protected int _avroParserFeatures | |
| _avroRecyclerPool | back to summary |
|---|---|
protected RecyclerPool<ApacheCodecRecycler> _avroRecyclerPool
| |
| _useApacheLibDecoder | back to summary |
|---|---|
| protected boolean _useApacheLibDecoder Flag that is set if Apache Avro lib's decoder is to be used for decoding; `false` to use Jackson native Avro decoder.
| |
| DEFAULT_AVRO_GENERATOR_FEATURE_FLAGS | back to summary |
|---|---|
| pack-priv static final int DEFAULT_AVRO_GENERATOR_FEATURE_FLAGS Bitfield (set of flags) of all generator features that are enabled by default. | |
| DEFAULT_AVRO_PARSER_FEATURE_FLAGS | back to summary |
|---|---|
| pack-priv static final int DEFAULT_AVRO_PARSER_FEATURE_FLAGS Bitfield (set of flags) of all parser features that are enabled by default. | |
| FORMAT_NAME_AVRO | back to summary |
|---|---|
| public static final String FORMAT_NAME_AVRO | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides com. | |
| AvroFactory | back to summary |
|---|---|
| public AvroFactory() Default constructor used to create factory instances. Creation of a factory instance is a light-weight operation, but it is still a good idea to reuse limited number of factory instances (and quite often just a single instance): factories are used as context for storing some reused processing objects (such as symbol tables parsers use) and this reuse only works within context of a single factory instance. | |
| AvroFactory | back to summary |
|---|---|
| public AvroFactory(ObjectCodec oc) | |
| AvroFactory | back to summary |
|---|---|
| protected AvroFactory(AvroFactory src, ObjectCodec oc) | |
| AvroFactory | back to summary |
|---|---|
| protected AvroFactory(AvroFactoryBuilder b) Constructors used by
| |
| _createGenerator | back to summary |
|---|---|
| protected JsonGenerator _createGenerator(Writer out, IOContext ctxt) throws IOException Overrides com. Overridable factory method that actually instantiates desired generator.
| |
| _createGenerator | back to summary |
|---|---|
| protected AvroGenerator _createGenerator(OutputStream out, IOContext ctxt) throws IOException | |
| _createParser | back to summary |
|---|---|
| protected AvroParser _createParser(InputStream in, IOContext ctxt) throws IOException Overrides com. Overridable factory method that actually instantiates desired parser.
| |
| _createParser | back to summary |
|---|---|
| protected JsonParser _createParser(Reader r, IOContext ctxt) throws IOException Overrides com. Doc from com. Overridable factory method that actually instantiates parser
using given 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.
| |
| _createParser | back to summary |
|---|---|
| protected JsonParser _createParser(char[] data, int offset, int len, IOContext ctxt, boolean recyclable) throws IOException Overrides com. Doc from com. Overridable factory method that actually instantiates parser
using given
| |
| _createParser | back to summary |
|---|---|
| protected AvroParser _createParser(byte[] data, int offset, int len, IOContext ctxt) throws IOException Overrides com. Doc from com. Overridable factory method that actually instantiates parser
using given 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.
| |
| _createWriter | back to summary |
|---|---|
| protected Writer _createWriter(OutputStream out, JsonEncoding enc, IOContext ctxt) throws IOException Overrides com.
| |
| _nonByteSource | back to summary |
|---|---|
| protected <T> T _nonByteSource() throws IOException | |
| _nonByteTarget | back to summary |
|---|---|
| protected <T> T _nonByteTarget() throws IOException | |
| builder | back to summary |
|---|---|
| public static AvroFactoryBuilder builder() Hides com. Main factory method to use for constructing a builder for creating
| |
| builderWithApacheDecoder | back to summary |
|---|---|
| public static AvroFactoryBuilder builderWithApacheDecoder() Main factory method to use for constructing a builder for creating
| |
| builderWithNativeDecoder | back to summary |
|---|---|
| public static AvroFactoryBuilder builderWithNativeDecoder() Main factory method to use for constructing a builder for creating
| |
| canHandleBinaryNatively | back to summary |
|---|---|
| public boolean canHandleBinaryNatively() Overrides com. Doc from com. 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
| |
| canUseSchema | back to summary |
|---|---|
| public boolean canUseSchema(FormatSchema schema) Overrides com. Doc from com. 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.
| |
| configure | back to summary |
|---|---|
| public final AvroFactory configure(AvroParser. Method for enabling or disabling specified parser feature
(check | |
| configure | back to summary |
|---|---|
| public final AvroFactory configure(AvroGenerator. Method for enabling or disabling specified generator feature
(check | |
| copy | back to summary |
|---|---|
| public AvroFactory copy() Overrides com. Doc from com. Method for constructing a new
| |
| createGenerator | back to summary |
|---|---|
| public AvroGenerator createGenerator(OutputStream out, JsonEncoding enc) throws IOException Overrides com. Note co-variant return type
| |
| createGenerator | back to summary |
|---|---|
| public AvroGenerator createGenerator(OutputStream out) throws IOException Overrides com. Since Avro format always uses UTF-8 internally, no encoding need to be passed to this method.
| |
| createParser | back to summary |
|---|---|
| public AvroParser createParser(File f) throws IOException Overrides com. Doc from com. Method for constructing JSON parser instance to parse 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 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.
| |
| createParser | back to summary |
|---|---|
| public AvroParser createParser(URL url) throws IOException Overrides com. Doc from com. Method for constructing JSON parser instance to parse contents of resource reference by given URL.
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 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. | |
| createParser | back to summary |
|---|---|
| public AvroParser createParser(InputStream in) throws IOException Overrides com. Doc from com. 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) 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 | back to summary |
|---|---|
| public AvroParser createParser(byte[] data) throws IOException Overrides com. Doc from com. Method for constructing parser for parsing the contents of given byte array.
| |
| createParser | back to summary |
|---|---|
| public AvroParser createParser(byte[] data, int offset, int len) throws IOException Overrides com. Doc from com. Method for constructing parser for parsing the contents of given byte array.
| |
| disable | back to summary |
|---|---|
| public AvroFactory disable(AvroParser. Method for disabling specified parser features
(check | |
| disable | back to summary |
|---|---|
| public AvroFactory disable(AvroGenerator. Method for disabling specified generator feature
(check | |
| enable | back to summary |
|---|---|
| public AvroFactory enable(AvroParser. Method for enabling specified parser feature
(check | |
| enable | back to summary |
|---|---|
| public AvroFactory enable(AvroGenerator. Method for enabling specified generator features
(check | |
| getFormatGeneratorFeatures | back to summary |
|---|---|
| public int getFormatGeneratorFeatures() Overrides com.
| |
| getFormatName | back to summary |
|---|---|
| public String getFormatName() Overrides com. Doc from com. 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 | |
| getFormatParserFeatures | back to summary |
|---|---|
| public int getFormatParserFeatures() Overrides com.
| |
| hasFormat | back to summary |
|---|---|
| public MatchStrength hasFormat(InputAccessor acc) throws IOException Overrides com. Sub-classes need to override this method
| |
| isEnabled | back to summary |
|---|---|
| public final boolean isEnabled(AvroParser. Checked whether specified parser feature is enabled. | |
| isEnabled | back to summary |
|---|---|
| public final boolean isEnabled(AvroGenerator. Check whether specified generator feature is enabled. | |
| readResolve | back to summary |
|---|---|
| protected Object readResolve() Overrides com. Method that we need to override to actually make restoration go through constructors etc. Also: must be overridden by sub-classes as well.
| |
| rebuild | back to summary |
|---|---|
| public AvroFactoryBuilder rebuild() Overrides com. Doc from com. Method that allows construction of differently configured factory, starting with settings of this factory.
| |
| requiresPropertyOrdering | back to summary |
|---|---|
| public boolean requiresPropertyOrdering() Overrides com. Doc from com. Introspection method that higher-level functionality may call to see whether underlying data format requires a stable ordering of object properties or not. This is usually used for determining whether to force a stable ordering (like alphabetic ordering by name) if no ordering if explicitly specified.
Default implementation returns
| |
| version | back to summary |
|---|---|
| public Version version() Overrides com. Implements com. Doc from com. 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 | |