Top Description Fields Constructors Methods
com.fasterxml.jackson.dataformat.avro.apacheimpl

public Class ApacheAvroParserImpl

extends AvroParserImpl
Class Inheritance
Imports
java.io.IOException, .InputStream, .Writer, org.apache.avro.io.BinaryDecoder, .DecoderFactory, com.fasterxml.jackson.core.*, com.fasterxml.jackson.core.io.IOContext, com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl, .AvroReadContext

Implementation class that exposes additional internal API to be used as callbacks by AvroReadContext implementations.

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 com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl:
_branchIndex_enumIndex_numberFloat

Constructor Summary

AccessConstructor and Description
public
ApacheAvroParserImpl(IOContext ctxt, int parserFeatures, int avroFeatures, ApacheCodecRecycler apacheCodecRecycler, ObjectCodec codec, InputStream in)

public
ApacheAvroParserImpl(IOContext ctxt, int parserFeatures, int avroFeatures, ApacheCodecRecycler apacheCodecRecycler, ObjectCodec codec, byte[] buffer, int offset, int len)

Method Summary

Modifier and TypeMethod and Description
protected void
protected void
_releaseBuffers()

Overrides com.fasterxml.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 Object
getInputSource()

Implements abstract com.fasterxml.jackson.dataformat.avro.AvroParser.getInputSource.

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.

public String
getText()

Implements abstract com.fasterxml.jackson.dataformat.avro.AvroParser.getText.

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
getText(Writer
Writer to write textual content to
writer
)

Implements abstract com.fasterxml.jackson.dataformat.avro.AvroParser.getText.

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

public boolean
hasTextCharacters()

Implements abstract com.fasterxml.jackson.dataformat.avro.AvroParser.hasTextCharacters.

Method that can be used to determine whether calling of getTextCharacters would be the most efficient way to access textual content for the event parser currently points to.

public String
nextTextValue()

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.nextTextValue.

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
Inherited from com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl:
_checkNumericValue_initSchemabranchIndexcloseconvertNumberToBigDecimalconvertNumberToBigIntegerconvertNumberToDoubleconvertNumberToFloatconvertNumberToIntconvertNumberToLongenumIndexgetFloatValuegetNumberTypegetNumberTypeFPgetNumberValuegetNumberValueExactgetRemainingElementsisNaNisRecordnextFieldNamenextFieldNamenextTokenoverrideFormatFeaturessetAvroContextsetBytessetNumbersetNumbersetNumbersetNumberskipValue

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(IOContext ctxt, int parserFeatures, int avroFeatures, ApacheCodecRecycler apacheCodecRecycler, ObjectCodec codec, InputStream in)
ApacheAvroParserImplback to summary
public ApacheAvroParserImpl(IOContext ctxt, int parserFeatures, int avroFeatures, ApacheCodecRecycler apacheCodecRecycler, ObjectCodec codec, byte[] buffer, int offset, int len)

Method Detail

_closeInputback to summary
protected void _closeInput() throws IOException

Implements abstract com.fasterxml.jackson.dataformat.avro.AvroParser._closeInput.

Annotations
@Override
_releaseBuffersback to summary
protected void _releaseBuffers() throws IOException

Overrides com.fasterxml.jackson.core.base.ParserBase._releaseBuffers.

Doc from com.fasterxml.jackson.core.base.ParserBase._releaseBuffers.

Method called to release internal buffers owned by the base reader. This may be called along with _closeInput (for example, when explicitly closing this reader instance), or separately (if need be).

Annotations
@Override
Exceptions
IOException:
Not thrown by base implementation but could be thrown by sub-classes
checkInputEndback to summary
public boolean checkInputEnd() throws IOException

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.checkInputEnd.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.decodeArrayNext.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.decodeArrayStart.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.decodeBoolean.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.decodeBytes.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.decodeDouble.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.decodeEnum.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.decodeFixed.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.decodeFloat.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.decodeIndex.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.decodeInt.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.decodeIntToken.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.decodeLong.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.decodeLongToken.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.decodeMapKey.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.decodeMapNext.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.decodeMapStart.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.decodeString.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.decodeStringToken.

Annotations
@Override
getInputSourceback to summary
public Object getInputSource()

Implements abstract com.fasterxml.jackson.dataformat.avro.AvroParser.getInputSource.

Doc from com.fasterxml.jackson.core.JsonParser.getInputSource.

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.

Returns:Object

Input source this parser was configured with

Annotations
@Override
getTextback to summary
public String getText() throws IOException

Implements abstract com.fasterxml.jackson.dataformat.avro.AvroParser.getText.

Doc from com.fasterxml.jackson.core.JsonParser.getText.

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.

Returns:String

Textual value associated with the current token (one returned by nextToken() or other iteration methods)

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems, including if the text is too large, see com.fasterxml.jackson.core.StreamReadConstraints.Builder#maxStringLength(int)
getTextback to summary
public int getText(Writer writer) throws IOException

Implements abstract com.fasterxml.jackson.dataformat.avro.AvroParser.getText.

Doc from com.fasterxml.jackson.core.JsonParser.getText.

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

  writer.write(parser.getText());
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

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

Parameters
writer:Writer

Writer to write textual content to

Returns:int

The number of characters written to the Writer

Annotations
@Override
Exceptions
IOException:
for low-level read issues or writes using passed writer, or JsonParseException for decoding problems
hasTextCharactersback to summary
public boolean hasTextCharacters()

Implements abstract com.fasterxml.jackson.dataformat.avro.AvroParser.hasTextCharacters.

Doc from com.fasterxml.jackson.core.JsonParser.hasTextCharacters.

Method that can be used to determine whether calling of getTextCharacters would be the most efficient way to access textual content for the event parser currently points to.

Default implementation simply returns false since only actual implementation class has knowledge of its internal buffering state. Implementations are strongly encouraged to properly override this method, to allow efficient copying of content by other code.

Returns:boolean

True if parser currently has character array that can be efficiently returned via getTextCharacters; false means that it may or may not exist

Annotations
@Override
nextTextValueback to summary
public String nextTextValue() throws IOException

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.nextTextValue.

Doc from com.fasterxml.jackson.core.JsonParser.nextTextValue.

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) ? getText() : 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.
Returns:String

Text value of the JsonToken.VALUE_STRING token parser advanced to; or null if next token is of some other type

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
setStringback to summary
protected JsonToken setString(String str)

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.setString.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.skipArray.

Returns:long

Doc from com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.skipArray.

Either 0, in which case all entries have been successfully skipped; or positive non-zero number to indicate elements that caller has to skip

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.skipBoolean.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.skipBytes.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.skipDouble.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.skipFixed.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.skipFloat.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.skipInt.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.skipLong.

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.skipMap.

Returns:long

Doc from com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.skipMap.

Either 0, in which case all entries have been successfully skipped; or positive non-zero number to indicate map entries that caller has to skip

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

Implements abstract com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl.skipString.

Annotations
@Override