com.fasterxml.jackson.dataformat.avro

## Class AvroFactory

- java.lang.Object
- - com.fasterxml.jackson.core.JsonFactory
  - - com.fasterxml.jackson.dataformat.avro.AvroFactory

- All Implemented Interfaces:
    com.fasterxml.jackson.core.Versioned, Serializable
  Direct Known Subclasses:
    ApacheAvroFactory

      public class AvroFactory
      extends com.fasterxml.jackson.core.JsonFactory

  Default `JsonFactory` implementation for encoding/decoding Avro content, uses native Jackson encoder/decoder.
  See Also:
    `ApacheAvroFactory`, Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.fasterxml.jackson.core.JsonFactory

      `com.fasterxml.jackson.core.JsonFactory.Feature`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `_avroGeneratorFeatures`
    `protected int` | `_avroParserFeatures`
    `static String` | `FORMAT_NAME_AVRO`

    - ### Fields inherited from class com.fasterxml.jackson.core.JsonFactory

      `_byteSymbolCanonicalizer, _characterEscapes, _factoryFeatures, _generatorFeatures, _inputDecorator, _objectCodec, _outputDecorator, _parserFeatures, _recyclerRef, _rootCharSymbols, _rootValueSeparator, DEFAULT_FACTORY_FEATURE_FLAGS, DEFAULT_GENERATOR_FEATURE_FLAGS, DEFAULT_PARSER_FEATURE_FLAGS, FORMAT_NAME_JSON`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `AvroFactory()` Default constructor used to create factory instances.
    `protected` | `AvroFactory(AvroFactory src, com.fasterxml.jackson.core.ObjectCodec oc)`
    `` | `AvroFactory(com.fasterxml.jackson.core.ObjectCodec oc)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected AvroGenerator` | `_createGenerator(OutputStream out, com.fasterxml.jackson.core.io.IOContext ctxt)`
    `protected com.fasterxml.jackson.core.JsonGenerator` | `_createGenerator(Writer out, com.fasterxml.jackson.core.io.IOContext ctxt)` Overridable factory method that actually instantiates desired generator.
    `protected AvroParser` | `_createParser(byte[] data, int offset, int len, com.fasterxml.jackson.core.io.IOContext ctxt)`
    `protected com.fasterxml.jackson.core.JsonParser` | `_createParser(char[] data, int offset, int len, com.fasterxml.jackson.core.io.IOContext ctxt, boolean recyclable)`
    `protected AvroParser` | `_createParser(InputStream in, com.fasterxml.jackson.core.io.IOContext ctxt)` Overridable factory method that actually instantiates desired parser.
    `protected com.fasterxml.jackson.core.JsonParser` | `_createParser(Reader r, com.fasterxml.jackson.core.io.IOContext ctxt)`
    `protected Writer` | `_createWriter(OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc, com.fasterxml.jackson.core.io.IOContext ctxt)`
    `protected <T> T` | `_nonByteSource()`
    `protected <T> T` | `_nonByteTarget()`
    `boolean` | `canUseSchema(com.fasterxml.jackson.core.FormatSchema schema)`
    `AvroFactory` | `configure(AvroGenerator.Feature f, boolean state)` Method for enabling or disabling specified generator feature (check `AvroGenerator.Feature` for list of features)
    `AvroFactory` | `configure(AvroParser.Feature f, boolean state)` Method for enabling or disabling specified parser feature (check `AvroParser.Feature` for list of features)
    `AvroFactory` | `copy()`
    `AvroGenerator` | `createGenerator(OutputStream out)` Since Avro format always uses UTF-8 internally, no encoding need to be passed to this method.
    `AvroGenerator` | `createGenerator(OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc)` note: co-variant return type
    `AvroParser` | `createParser(byte[] data)`
    `AvroParser` | `createParser(byte[] data, int offset, int len)`
    `AvroParser` | `createParser(File f)`
    `AvroParser` | `createParser(InputStream in)`
    `AvroParser` | `createParser(URL url)`
    `AvroFactory` | `disable(AvroGenerator.Feature f)` Method for disabling specified generator feature (check `AvroGenerator.Feature` for list of features)
    `AvroFactory` | `disable(AvroParser.Feature f)` Method for disabling specified parser features (check `AvroParser.Feature` for list of features)
    `AvroFactory` | `enable(AvroGenerator.Feature f)` Method for enabling specified generator features (check `AvroGenerator.Feature` for list of features)
    `AvroFactory` | `enable(AvroParser.Feature f)` Method for enabling specified parser feature (check `AvroParser.Feature` for list of features)
    `String` | `getFormatName()`
    `com.fasterxml.jackson.core.format.MatchStrength` | `hasFormat(com.fasterxml.jackson.core.format.InputAccessor acc)` Sub-classes need to override this method
    `boolean` | `isEnabled(AvroGenerator.Feature f)` Check whether specified generator feature is enabled.
    `boolean` | `isEnabled(AvroParser.Feature f)` Checked whether specified parser feature is enabled.
    `protected Object` | `readResolve()` Method that we need to override to actually make restoration go through constructors etc.
    `boolean` | `requiresPropertyOrdering()`
    `com.fasterxml.jackson.core.Version` | `version()`

    - ### Methods inherited from class com.fasterxml.jackson.core.JsonFactory

      `_checkInvalidCopy, _createContext, _createDataOutputWrapper, _createParser, _createUTF8Generator, _decorate, _decorate, _decorate, _decorate, _decorate, _getBufferRecycler, _optimizedStreamFromURL, canHandleBinaryNatively, canParseAsync, canUseCharArrays, configure, configure, configure, createGenerator, createGenerator, createGenerator, createGenerator, createJsonGenerator, createJsonGenerator, createJsonGenerator, createJsonParser, createJsonParser, createJsonParser, createJsonParser, createJsonParser, createJsonParser, createJsonParser, createNonBlockingByteArrayParser, createParser, createParser, createParser, createParser, createParser, disable, disable, disable, enable, enable, enable, getCharacterEscapes, getCodec, getFormatReadFeatureType, getFormatWriteFeatureType, getInputDecorator, getOutputDecorator, getRootValueSeparator, hasJSONFormat, isEnabled, isEnabled, isEnabled, requiresCustomCodec, setCharacterEscapes, setCodec, setInputDecorator, setOutputDecorator, setRootValueSeparator`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### FORMAT_NAME_AVRO

          public static final String FORMAT_NAME_AVRO

      See Also:
        Constant Field Values

    - #### _avroParserFeatures

          protected int _avroParserFeatures

    - #### _avroGeneratorFeatures

          protected int _avroGeneratorFeatures

  - ### Constructor Detail

    - #### AvroFactory

          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

          public AvroFactory(com.fasterxml.jackson.core.ObjectCodec oc)

    - #### AvroFactory

          protected AvroFactory(AvroFactory src,
                     com.fasterxml.jackson.core.ObjectCodec oc)

  - ### Method Detail

    - #### copy

          public AvroFactory copy()

      Overrides:
        `copy` in class `com.fasterxml.jackson.core.JsonFactory`

    - #### requiresPropertyOrdering

          public boolean requiresPropertyOrdering()

      Overrides:
        `requiresPropertyOrdering` in class `com.fasterxml.jackson.core.JsonFactory`

    - #### readResolve

          protected Object readResolve()

      Method that we need to override to actually make restoration go through constructors etc. Also: must be overridden by sub-classes as well.
      Overrides:
        `readResolve` in class `com.fasterxml.jackson.core.JsonFactory`

    - #### version

          public com.fasterxml.jackson.core.Version version()

      Specified by:
        `version` in interface `com.fasterxml.jackson.core.Versioned`
      Overrides:
        `version` in class `com.fasterxml.jackson.core.JsonFactory`

    - #### getFormatName

          public String getFormatName()

      Overrides:
        `getFormatName` in class `com.fasterxml.jackson.core.JsonFactory`

    - #### canUseSchema

          public boolean canUseSchema(com.fasterxml.jackson.core.FormatSchema schema)

      Overrides:
        `canUseSchema` in class `com.fasterxml.jackson.core.JsonFactory`

    - #### hasFormat

          public com.fasterxml.jackson.core.format.MatchStrength hasFormat(com.fasterxml.jackson.core.format.InputAccessor acc)
                                                                    throws IOException

      Sub-classes need to override this method
      Overrides:
        `hasFormat` in class `com.fasterxml.jackson.core.JsonFactory`
      Throws:
        `IOException`

    - #### configure

          public final AvroFactory configure(AvroParser.Feature f,
                              boolean state)

      Method for enabling or disabling specified parser feature (check `AvroParser.Feature` for list of features)

    - #### enable

          public AvroFactory enable(AvroParser.Feature f)

      Method for enabling specified parser feature (check `AvroParser.Feature` for list of features)

    - #### disable

          public AvroFactory disable(AvroParser.Feature f)

      Method for disabling specified parser features (check `AvroParser.Feature` for list of features)

    - #### isEnabled

          public final boolean isEnabled(AvroParser.Feature f)

      Checked whether specified parser feature is enabled.

    - #### configure

          public final AvroFactory configure(AvroGenerator.Feature f,
                              boolean state)

      Method for enabling or disabling specified generator feature (check `AvroGenerator.Feature` for list of features)

    - #### enable

          public AvroFactory enable(AvroGenerator.Feature f)

      Method for enabling specified generator features (check `AvroGenerator.Feature` for list of features)

    - #### disable

          public AvroFactory disable(AvroGenerator.Feature f)

      Method for disabling specified generator feature (check `AvroGenerator.Feature` for list of features)

    - #### isEnabled

          public final boolean isEnabled(AvroGenerator.Feature f)

      Check whether specified generator feature is enabled.

    - #### createParser

          public AvroParser createParser(File f)
                                  throws IOException

      Overrides:
        `createParser` in class `com.fasterxml.jackson.core.JsonFactory`
      Throws:
        `IOException`

    - #### createParser

          public AvroParser createParser(URL url)
                                  throws IOException

      Overrides:
        `createParser` in class `com.fasterxml.jackson.core.JsonFactory`
      Throws:
        `IOException`

    - #### createParser

          public AvroParser createParser(InputStream in)
                                  throws IOException

      Overrides:
        `createParser` in class `com.fasterxml.jackson.core.JsonFactory`
      Throws:
        `IOException`

    - #### createParser

          public AvroParser createParser(byte[] data)
                                  throws IOException

      Overrides:
        `createParser` in class `com.fasterxml.jackson.core.JsonFactory`
      Throws:
        `IOException`

    - #### createParser

          public AvroParser createParser(byte[] data,
                                int offset,
                                int len)
                                  throws IOException

      Overrides:
        `createParser` in class `com.fasterxml.jackson.core.JsonFactory`
      Throws:
        `IOException`

    - #### createGenerator

          public AvroGenerator createGenerator(OutputStream out,
                                      com.fasterxml.jackson.core.JsonEncoding enc)
                                        throws IOException

      note: co-variant return type

      Overrides:
        `createGenerator` in class `com.fasterxml.jackson.core.JsonFactory`
      Throws:
        `IOException`

    - #### createGenerator

          public AvroGenerator createGenerator(OutputStream out)
                                        throws IOException

      Since Avro format always uses UTF-8 internally, no encoding need to be passed to this method.
      Overrides:
        `createGenerator` in class `com.fasterxml.jackson.core.JsonFactory`
      Throws:
        `IOException`

    - #### _createParser

          protected AvroParser _createParser(InputStream in,
                                 com.fasterxml.jackson.core.io.IOContext ctxt)
                                      throws IOException

      Overridable factory method that actually instantiates desired parser.
      Overrides:
        `_createParser` in class `com.fasterxml.jackson.core.JsonFactory`
      Throws:
        `IOException`

    - #### _createParser

          protected com.fasterxml.jackson.core.JsonParser _createParser(Reader r,
                                                            com.fasterxml.jackson.core.io.IOContext ctxt)
                                                                 throws IOException

      Overrides:
        `_createParser` in class `com.fasterxml.jackson.core.JsonFactory`
      Throws:
        `IOException`

    - #### _createParser

          protected com.fasterxml.jackson.core.JsonParser _createParser(char[] data,
                                                            int offset,
                                                            int len,
                                                            com.fasterxml.jackson.core.io.IOContext ctxt,
                                                            boolean recyclable)
                                                                 throws IOException

      Overrides:
        `_createParser` in class `com.fasterxml.jackson.core.JsonFactory`
      Throws:
        `IOException`

    - #### _createParser

          protected AvroParser _createParser(byte[] data,
                                 int offset,
                                 int len,
                                 com.fasterxml.jackson.core.io.IOContext ctxt)
                                      throws IOException

      Overrides:
        `_createParser` in class `com.fasterxml.jackson.core.JsonFactory`
      Throws:
        `IOException`

    - #### _createGenerator

          protected com.fasterxml.jackson.core.JsonGenerator _createGenerator(Writer out,
                                                                  com.fasterxml.jackson.core.io.IOContext ctxt)
                                                                       throws IOException

      Overridable factory method that actually instantiates desired generator.
      Overrides:
        `_createGenerator` in class `com.fasterxml.jackson.core.JsonFactory`
      Throws:
        `IOException`

    - #### _createWriter

          protected Writer _createWriter(OutputStream out,
                             com.fasterxml.jackson.core.JsonEncoding enc,
                             com.fasterxml.jackson.core.io.IOContext ctxt)
                                  throws IOException

      Overrides:
        `_createWriter` in class `com.fasterxml.jackson.core.JsonFactory`
      Throws:
        `IOException`

    - #### _createGenerator

          protected AvroGenerator _createGenerator(OutputStream out,
                                       com.fasterxml.jackson.core.io.IOContext ctxt)
                                            throws IOException

      Throws:
        `IOException`

    - #### _nonByteSource

          protected <T> T _nonByteSource()
                              throws IOException

      Throws:
        `IOException`

    - #### _nonByteTarget

          protected <T> T _nonByteTarget()
                              throws IOException

      Throws:
        `IOException`

Copyright © 2017 FasterXML. All rights reserved.