Top Description Fields Constructors Methods
tools.jackson.dataformat.avro.apacheimpl

public Class ApacheAvroParserImpl

extends AvroParserImpl
Class Inheritance
Imports
java.io.*, org.apache.avro.io.BinaryDecoder, .DecoderFactory, tools.jackson.core.*, tools.jackson.core.io.IOContext, tools.jackson.dataformat.avro.AvroSchema, .AvroReadFeature, tools.jackson.dataformat.avro.deser.AvroParserImpl

Parser implementation that uses decoder from Apache Avro lib, instead of Jackson native Avro decoder.

Field Summary

Modifier and TypeField and Description
protected ApacheCodecRecycler
protected boolean
_bufferRecyclable

Flag that indicates whether the input buffer is recycable (and needs to be returned to recycler once we are done) or not.

protected BinaryDecoder
_decoder

Actual decoder in use, possible same as _rootDecoder, but not necessarily, in case of different reader/writer schema in use.

protected byte[]
_inputBuffer

Current buffer from which data is read; generally data is read into buffer from input source, but in some cases pre-loaded buffer is handed to the parser.

protected InputStream
protected String
_textValue

We need to keep track of text values.

protected static final DecoderFactory
Inherited from tools.jackson.dataformat.avro.deser.AvroParserImpl:
_branchIndex_enumIndex

Constructor Summary

AccessConstructor and Description
public
ApacheAvroParserImpl(ObjectReadContext readCtxt, IOContext ioCtxt, int parserFeatures, int avroFeatures, ApacheCodecRecycler apacheCodecRecycler, AvroSchema schema, InputStream in)

public
ApacheAvroParserImpl(ObjectReadContext readCtxt, IOContext ioCtxt, int parserFeatures, int avroFeatures, ApacheCodecRecycler apacheCodecRecycler, AvroSchema schema, byte[] buffer, int offset, int len)

Method Summary

Modifier and TypeMethod and Description
protected void
_closeInput()

Implements abstract tools.jackson.dataformat.avro.AvroParser._closeInput.

Abstract method for sub-classes to implement; to be called by close() implementation here.

protected void
_releaseBuffers()

Overrides tools.jackson.core.base.ParserBase._releaseBuffers.

Method called to release internal buffers owned by the base reader.

public boolean
public long
public long
public JsonToken
public JsonToken
public JsonToken
public int
public JsonToken
public JsonToken
public int
public int
public JsonToken
public long
public JsonToken
public String
public long
public long
public void
public JsonToken
public String
getString()

Implements abstract tools.jackson.dataformat.avro.AvroParser.getString.

Method for accessing textual representation of the current token; if no current token (before first call to nextToken, or after encountering end-of-input), returns null.

public int
getString(Writer writer)

Implements abstract tools.jackson.dataformat.avro.AvroParser.getString.

Method to read the textual representation of the current token in chunks and pass it to the given Writer.

public boolean
hasStringCharacters()

Implements abstract tools.jackson.dataformat.avro.AvroParser.hasStringCharacters.

Method that can be used to determine whether calling of getStringCharacters would be the most efficient way to access String value for the event parser currently points to (compared to getString()).

public String
nextStringValue()

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.nextStringValue.

Method that fetches next token (as if calling nextToken) and if it is JsonToken#VALUE_STRING returns contained String value; otherwise returns null.

protected JsonToken
public long
public void
public void
public void
public void
public void
public void
public void
public long
public void
public Object
streamReadInputSource()

Implements abstract tools.jackson.dataformat.avro.AvroParser.streamReadInputSource.

Method that can be used to get access to object that is used to access input being parsed; this is usually either InputStream or Reader, depending on what parser was constructed with.

Inherited from tools.jackson.dataformat.avro.deser.AvroParserImpl:
_checkNumericValue_initSchemabranchIndexcloseconvertNumberToBigDecimalconvertNumberToBigIntegerconvertNumberToDoubleconvertNumberToFloatconvertNumberToIntconvertNumberToLongdecodeBytesDecimaldecodeFixedDecimalenumIndexgetFloatValuegetNumberTypegetNumberTypeFPgetNumberValuegetNumberValueExactgetRemainingElementsisNaNisRecordnextNamenextNamenextNameMatchnextTokensetAvroContextsetBytessetNumbersetNumbersetNumbersetNumberskipBytesDecimalskipFixedDecimalskipValue

Field Detail

_apacheCodecRecyclerback to summary
protected ApacheCodecRecycler _apacheCodecRecycler
Since
2.16
_bufferRecyclableback to summary
protected boolean _bufferRecyclable

Flag that indicates whether the input buffer is recycable (and needs to be returned to recycler once we are done) or not.

If it is not, it also means that parser can NOT modify underlying buffer.

_decoderback to summary
protected BinaryDecoder _decoder

Actual decoder in use, possible same as _rootDecoder, but not necessarily, in case of different reader/writer schema in use.

_inputBufferback to summary
protected byte[] _inputBuffer

Current buffer from which data is read; generally data is read into buffer from input source, but in some cases pre-loaded buffer is handed to the parser.

_inputStreamback to summary
protected InputStream _inputStream
_textValueback to summary
protected String _textValue

We need to keep track of text values.

DECODER_FACTORYback to summary
protected static final DecoderFactory DECODER_FACTORY
Since
2.16

Constructor Detail

ApacheAvroParserImplback to summary
public ApacheAvroParserImpl(ObjectReadContext readCtxt, IOContext ioCtxt, int parserFeatures, int avroFeatures, ApacheCodecRecycler apacheCodecRecycler, AvroSchema schema, InputStream in)
ApacheAvroParserImplback to summary
public ApacheAvroParserImpl(ObjectReadContext readCtxt, IOContext ioCtxt, int parserFeatures, int avroFeatures, ApacheCodecRecycler apacheCodecRecycler, AvroSchema schema, byte[] buffer, int offset, int len)

Method Detail

_closeInputback to summary
protected void _closeInput() throws IOException

Implements abstract tools.jackson.dataformat.avro.AvroParser._closeInput.

Doc from tools.jackson.core.base.ParserMinimalBase._closeInput.

Abstract method for sub-classes to implement; to be called by close() implementation here.

Annotations
@Override
Exceptions
IOException:
from underlying input source if thrown
_releaseBuffersback to summary
protected void _releaseBuffers()

Overrides tools.jackson.core.base.ParserBase._releaseBuffers.

Doc from tools.jackson.core.base.ParserMinimalBase._releaseBuffers.

Method called to release internal buffers owned by the base reader. This is expected to be called after _closeInput since the buffers are expected not to be needed any longer.

Annotations
@Override
checkInputEndback to summary
public boolean checkInputEnd() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.checkInputEnd.

Annotations
@Override
decodeArrayNextback to summary
public long decodeArrayNext() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.decodeArrayNext.

Annotations
@Override
decodeArrayStartback to summary
public long decodeArrayStart() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.decodeArrayStart.

Annotations
@Override
decodeBooleanback to summary
public JsonToken decodeBoolean() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.decodeBoolean.

Annotations
@Override
decodeBytesback to summary
public JsonToken decodeBytes() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.decodeBytes.

Annotations
@Override
decodeDoubleback to summary
public JsonToken decodeDouble() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.decodeDouble.

Annotations
@Override
decodeEnumback to summary
public int decodeEnum() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.decodeEnum.

Annotations
@Override
decodeFixedback to summary
public JsonToken decodeFixed(int size) throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.decodeFixed.

Annotations
@Override
decodeFloatback to summary
public JsonToken decodeFloat() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.decodeFloat.

Annotations
@Override
decodeIndexback to summary
public int decodeIndex() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.decodeIndex.

Annotations
@Override
decodeIntback to summary
public int decodeInt() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.decodeInt.

Annotations
@Override
decodeIntTokenback to summary
public JsonToken decodeIntToken() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.decodeIntToken.

Annotations
@Override
decodeLongback to summary
public long decodeLong() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.decodeLong.

Annotations
@Override
decodeLongTokenback to summary
public JsonToken decodeLongToken() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.decodeLongToken.

Annotations
@Override
decodeMapKeyback to summary
public String decodeMapKey() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.decodeMapKey.

Annotations
@Override
decodeMapNextback to summary
public long decodeMapNext() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.decodeMapNext.

Annotations
@Override
decodeMapStartback to summary
public long decodeMapStart() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.decodeMapStart.

Annotations
@Override
decodeStringback to summary
public void decodeString() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.decodeString.

Annotations
@Override
decodeStringTokenback to summary
public JsonToken decodeStringToken() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.decodeStringToken.

Annotations
@Override
getStringback to summary
public String getString() throws JacksonException

Implements abstract tools.jackson.dataformat.avro.AvroParser.getString.

Doc from tools.jackson.core.JsonParser.getString.

Method for accessing textual representation of the current token; if no current token (before first call to nextToken, or after encountering end-of-input), returns null. Method can be called for any token type.

Annotations
@Override
getStringback to summary
public int getString(Writer writer) throws JacksonException

Implements abstract tools.jackson.dataformat.avro.AvroParser.getString.

Doc from tools.jackson.core.JsonParser.getString.

Method to read the textual representation of the current token in chunks and pass it to the given Writer. Functionally same as calling:

  writer.write(parser.getString());
but should typically be more efficient as longer content does need to be combined into a single String to return, and write can occur directly from intermediate buffers Jackson uses.

Note

String value will still be buffered (usually using TextBuffer) and will be accessible with other getString() calls (that is, it will not be consumed). So this accessor only avoids construction of java.lang.String compared to plain getString() method.

Note

In Jackson 2.x this method was called getString(Writer).

Annotations
@Override
hasStringCharactersback to summary
public boolean hasStringCharacters()

Implements abstract tools.jackson.dataformat.avro.AvroParser.hasStringCharacters.

Doc from tools.jackson.core.JsonParser.hasStringCharacters.

Method that can be used to determine whether calling of getStringCharacters would be the most efficient way to access String value for the event parser currently points to (compared to getString()).

Annotations
@Override
nextStringValueback to summary
public String nextStringValue() throws JacksonException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.nextStringValue.

Doc from tools.jackson.core.JsonParser.nextStringValue.

Method that fetches next token (as if calling nextToken) and if it is JsonToken#VALUE_STRING returns contained String value; otherwise returns null. It is functionally equivalent to:

  return (nextToken() == JsonToken.VALUE_STRING) ? getString() : null;
but may be faster for parser to process, and can therefore be used if caller expects to get a String value next from input.
Annotations
@Override
setStringback to summary
protected JsonToken setString(String str)

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.setString.

Annotations
@Override
skipArrayback to summary
public long skipArray() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.skipArray.

Annotations
@Override
skipBooleanback to summary
public void skipBoolean() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.skipBoolean.

Annotations
@Override
skipBytesback to summary
public void skipBytes() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.skipBytes.

Annotations
@Override
skipDoubleback to summary
public void skipDouble() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.skipDouble.

Annotations
@Override
skipFixedback to summary
public void skipFixed(int size) throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.skipFixed.

Annotations
@Override
skipFloatback to summary
public void skipFloat() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.skipFloat.

Annotations
@Override
skipIntback to summary
public void skipInt() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.skipInt.

Annotations
@Override
skipLongback to summary
public void skipLong() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.skipLong.

Annotations
@Override
skipMapback to summary
public long skipMap() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.skipMap.

Annotations
@Override
skipStringback to summary
public void skipString() throws IOException

Implements abstract tools.jackson.dataformat.avro.deser.AvroParserImpl.skipString.

Annotations
@Override
streamReadInputSourceback to summary
public Object streamReadInputSource()

Implements abstract tools.jackson.dataformat.avro.AvroParser.streamReadInputSource.

Doc from tools.jackson.core.JsonParser.streamReadInputSource.

Method that can be used to get access to object that is used to access input being parsed; this is usually either InputStream or Reader, depending on what parser was constructed with. Note that returned value may be null in some cases; including case where parser implementation does not want to exposed raw source to caller. In cases where input has been decorated, object returned here is the decorated version; this allows some level of interaction between users of parser and decorator object.

In general use of this accessor should be considered as "last effort", i.e. only used if no other mechanism is applicable.

Note

was named getInputSource() in Jackson 2.x.

Annotations
@Override