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

public Class JacksonAvroParserImpl

extends AvroParserImpl
Class Inheritance
Imports
java.io.IOException, .InputStream, .OutputStream, .Writer, com.fasterxml.jackson.core.*, com.fasterxml.jackson.core.io.IOContext

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

Field Summary

Modifier and TypeField and Description
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 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
public static final int[]
sUtf8UnitLengths

Additionally we can combine UTF-8 decoding info into similar data table.

Inherited from com.fasterxml.jackson.dataformat.avro.deser.AvroParserImpl:
_branchIndex_enumIndex_numberFloat

Constructor Summary

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

public
JacksonAvroParserImpl(IOContext ctxt, int parserFeatures, int avroFeatures, ObjectCodec codec, byte[] data, int offset, int len)

Method Summary

Modifier and TypeMethod and Description
protected void
private final long
public int
private long
_decodeLong2(int ptr, long lo)

public long
private long
private final int
_decodeUTF8_3(int c1)

private final int
private final void
_finishLongText(int len)

private final String
protected final boolean
protected final void
protected final void
_loadToHaveAtLeast(int minAvailable)

Helper method that will try to load at least specified number bytes in input buffer, possible moving existing data around if necessary

private final byte
private final byte
private final void
_read(byte[] target, int offset, int len)

protected void
_releaseBuffers()

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

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

private void
private void
private void
private void
_reportInvalidOther(int mask, int ptr)

private final void
_skip(int len)

private final void
private long
public void
private final void
_skipL(long len)

public void
public boolean
public long
public long
public JsonToken
public JsonToken
public JsonToken
public int
public JsonToken
public JsonToken
public int
public final 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.

public int
releaseBuffered(OutputStream
OutputStream to which buffered, undecoded content is written to
out
)

Overrides com.fasterxml.jackson.core.JsonParser.releaseBuffered.

Method that can be called to push back any content that has been read but not consumed by the parser.

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

_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.

_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
sUtf8UnitLengthsback to summary
public static final int[] sUtf8UnitLengths

Additionally we can combine UTF-8 decoding info into similar data table. Values indicate "byte length - 1"; meaning -1 is used for invalid bytes, 0 for single-byte codes, 1 for 2-byte codes and 2 for 3-byte codes.

Constructor Detail

JacksonAvroParserImplback to summary
public JacksonAvroParserImpl(IOContext ctxt, int parserFeatures, int avroFeatures, ObjectCodec codec, InputStream in)
JacksonAvroParserImplback to summary
public JacksonAvroParserImpl(IOContext ctxt, int parserFeatures, int avroFeatures, ObjectCodec codec, byte[] data, int offset, int len)

Method Detail

_closeInputback to summary
protected void _closeInput() throws IOException

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

Annotations
@SuppressWarnings:deprecation
@Override
_decodeChunkLengthback to summary
private final long _decodeChunkLength() throws IOException
_decodeIntSlowback to summary
public int _decodeIntSlow() throws IOException
_decodeLong2back to summary
private long _decodeLong2(int ptr, long lo) throws IOException
_decodeLongSlowback to summary
public long _decodeLongSlow() throws IOException
_decodeLongSlow2back to summary
private long _decodeLongSlow2(long lo) throws IOException
_decodeUTF8_3back to summary
private final int _decodeUTF8_3(int c1) throws IOException
_decodeUTF8_4back to summary
private final int _decodeUTF8_4(int c) throws IOException
_finishLongTextback to summary
private final void _finishLongText(int len) throws IOException
_finishShortTextback to summary
private final String _finishShortText(int len) throws IOException
_loadMoreback to summary
protected final boolean _loadMore() throws IOException
_loadMoreGuaranteedback to summary
protected final void _loadMoreGuaranteed() throws IOException
_loadToHaveAtLeastback to summary
protected final void _loadToHaveAtLeast(int minAvailable) throws IOException

Helper method that will try to load at least specified number bytes in input buffer, possible moving existing data around if necessary

_nextByteGuaranteedback to summary
private final byte _nextByteGuaranteed() throws IOException
_nextByteGuaranteed2back to summary
private final byte _nextByteGuaranteed2() throws IOException
_readback to summary
private final void _read(byte[] target, int offset, int len) throws IOException
_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
_reportInvalidInitialback to summary
private void _reportInvalidInitial(int mask) throws JsonParseException
_reportInvalidNegativeback to summary
private void _reportInvalidNegative(int v) throws IOException
_reportInvalidOtherback to summary
private void _reportInvalidOther(int mask) throws JsonParseException
_reportInvalidOtherback to summary
private void _reportInvalidOther(int mask, int ptr) throws JsonParseException
_skipback to summary
private final void _skip(int len) throws IOException
_skipByteGuaranteedback to summary
private final void _skipByteGuaranteed() throws IOException
_skipChunkElementsback to summary
private long _skipChunkElements() throws IOException
_skipIntSlowback to summary
public void _skipIntSlow() throws IOException
_skipLback to summary
private final void _skipL(long len) throws IOException
_skipLongSlowback to summary
public void _skipLongSlow() throws IOException
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 final 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
releaseBufferedback to summary
public int releaseBuffered(OutputStream out) throws IOException

Overrides com.fasterxml.jackson.core.JsonParser.releaseBuffered.

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

Method that can be called to push back any content that has been read but not consumed by the parser. This is usually done after reading all content of interest using parser. Content is released by writing it to given stream if possible; if underlying input is byte-based it can released, if not (char-based) it can not.

Parameters
out:OutputStream

OutputStream to which buffered, undecoded content is written to

Returns:int

-1 if the underlying content source is not byte based (that is, input can not be sent to OutputStream; otherwise number of bytes released (0 if there was nothing to release)

Annotations
@Override
Exceptions
IOException:
if write to stream threw exception
setStringback to summary
protected JsonToken setString(String str) throws IOException

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