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

public abstract Class AvroParserImpl

extends AvroParser
Class Inheritance
Known Direct Subclasses
com.fasterxml.jackson.dataformat.avro.deser.JacksonAvroParserImpl, com.fasterxml.jackson.dataformat.avro.apacheimpl.ApacheAvroParserImpl
Imports
java.io.*, java.math.BigDecimal, .BigInteger, com.fasterxml.jackson.core.*, com.fasterxml.jackson.core.io.IOContext, com.fasterxml.jackson.dataformat.avro.AvroParser, .AvroSchema

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

Field Summary

Modifier and TypeField and Description
protected int
_branchIndex

Index of the union branch that was followed to reach the current token.

protected int
_enumIndex

Index of the enum that was read as the current token.

protected float
_numberFloat

Hides com.fasterxml.jackson.core.base.ParserBase._numberFloat.

Value if decoded directly as `float`.
Inherited from com.fasterxml.jackson.dataformat.avro.AvroParser:
_avroContext_formatFeatures_objectCodec_rootSchemaAVRO_READ_CAPABILITIES

Constructor Summary

AccessConstructor and Description
protected
AvroParserImpl(IOContext ctxt, int parserFeatures, int avroFeatures, ObjectCodec codec)

Method Summary

Modifier and TypeMethod and Description
protected final void
_checkNumericValue(int expType)

public final void
public final int
public abstract boolean
public void
close()

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

Implements java.io.Closeable.close.

Closes the parser so that no further iteration or data access can be made; will also close the underlying input source if parser either owns the input source, or feature Feature#AUTO_CLOSE_SOURCE is enabled.

protected final void
protected final void
protected final void
protected final void
protected final void
protected final void
public abstract long
public abstract long
public abstract JsonToken
public abstract JsonToken
public abstract JsonToken
public abstract int
public abstract JsonToken
decodeFixed(int size)

public abstract JsonToken
public abstract int
public abstract int
public abstract JsonToken
public abstract long
public abstract JsonToken
public abstract String
public abstract long
public abstract long
public abstract void
public abstract JsonToken
public final int
public final float
getFloatValue()

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

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_FLOAT and it can be expressed as a Java float primitive type.

public final JsonParser.NumberType
getNumberType()

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

If current token is of type JsonToken#VALUE_NUMBER_INT or JsonToken#VALUE_NUMBER_FLOAT, returns one of NumberType constants; otherwise returns null.

public JsonParser.NumberTypeFP
getNumberTypeFP()

Overrides com.fasterxml.jackson.core.JsonParser.getNumberTypeFP.

If current token is of type JsonToken#VALUE_NUMBER_FLOAT, returns one of NumberTypeFP constants; otherwise returns NumberTypeFP#UNKNOWN.

public final Number
getNumberValue()

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

Generic number value accessor method that will work for all kinds of numeric values.

public final Number
getNumberValueExact()

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

Method similar to getNumberValue with the difference that for floating-point numbers value returned may be BigDecimal if the underlying format does not store floating-point numbers using native representation: for example, textual formats represent numbers as Strings (which are 10-based), and conversion to java.lang.Double is potentially lossy operation.

public long
getRemainingElements()

Returns the remaining number of elements in the current block of a map or array

public final boolean
isNaN()

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

Accessor for checking whether current token is a special "not-a-number" (NaN) token (including both "NaN" AND positive/negative infinity!).

public final boolean
public String
nextFieldName()

Overrides com.fasterxml.jackson.core.JsonParser.nextFieldName.

Method that fetches next token (as if calling nextToken) and verifies whether it is JsonToken#FIELD_NAME; if it is, returns same as currentName(), otherwise null.

public boolean
nextFieldName(SerializableString
Property name to compare next token to (if next token is JsonToken.FIELD_NAME)
sstr
)

Overrides com.fasterxml.jackson.core.JsonParser.nextFieldName.

Method that fetches next token (as if calling nextToken) and verifies whether it is JsonToken#FIELD_NAME with specified name and returns result of that comparison.

public abstract String
nextTextValue()

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

public JsonToken
nextToken()

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

Main iteration method, which will advance stream enough to determine type of the next token, if any.

public final JsonParser
overrideFormatFeatures(int
Bit mask of set/clear state for features to change
values
,
int
Bit mask of features to change
mask
)

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

Bulk set method for (re)setting states of FormatFeatures, by specifying values (set / clear) along with a mask, to determine which features to change, if any.

public final void
protected final JsonToken
setBytes(byte[] b)

protected final JsonToken
setNumber(int v)

protected final JsonToken
setNumber(long v)

protected final JsonToken
setNumber(float v)

protected final JsonToken
setNumber(double v)

protected abstract JsonToken
public abstract long

Returns:

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

public abstract void
public abstract void
public abstract void
public abstract void
skipFixed(int size)

public abstract void
public abstract void
public abstract void
public abstract long

Returns:

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
skipMap
()

public abstract void
public final void
skipValue()

Skip to the end of the current structure (array/map/object); This is different from skipMap() and skipArray() because it operates at the parser level instead of at the decoder level and advances the parsing context in addition to consuming the data from the input.

Inherited from com.fasterxml.jackson.dataformat.avro.AvroParser:
_closeInput_finishStringcanReadTypeIdcanUseSchemaconfigurecurrentLocationcurrentNamecurrentTokenLocationdisableenablegetBinaryValuegetCodecgetCurrentLocationgetCurrentNamegetEmbeddedObjectgetInputSourcegetReadCapabilitiesgetSchemagetTextgetTextgetTextCharactersgetTextLengthgetTextOffsetgetTokenLocationgetTypeIdhasTextCharactersisEnabledoverrideCurrentNamesetCodecsetSchemaversion

Field Detail

_branchIndexback to summary
protected int _branchIndex

Index of the union branch that was followed to reach the current token. This is cleared when the next token is read.

Since
2.9
_enumIndexback to summary
protected int _enumIndex

Index of the enum that was read as the current token. This is cleared when the next token is read.

Since
2.9
_numberFloatback to summary
protected float _numberFloat

Hides com.fasterxml.jackson.core.base.ParserBase._numberFloat.

Value if decoded directly as `float`.

Note

base class (`ParserBase`) has other value storage, but since JSON has no distinction between double, float, only includes `float`.

Since
2.9

Constructor Detail

AvroParserImplback to summary
protected AvroParserImpl(IOContext ctxt, int parserFeatures, int avroFeatures, ObjectCodec codec)

Method Detail

_checkNumericValueback to summary
protected final void _checkNumericValue(int expType) throws IOException
_initSchemaback to summary
public final void _initSchema(AvroSchema schema) throws IOException

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

Annotations
@Override
branchIndexback to summary
public final int branchIndex()
checkInputEndback to summary
public abstract boolean checkInputEnd() throws IOException
closeback to summary
public void close() throws IOException

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

Implements java.io.Closeable.close.

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

Closes the parser so that no further iteration or data access can be made; will also close the underlying input source if parser either owns the input source, or feature Feature#AUTO_CLOSE_SOURCE is enabled. Whether parser owns the input source depends on factory method that was used to construct instance (so check com.fasterxml.jackson.core.JsonFactory for details, but the general idea is that if caller passes in closable resource (such as InputStream or Reader) parser does NOT own the source; but if it passes a reference (such as java.io.File or java.net.URL and creates stream or reader it does own them.

Annotations
@Override
Exceptions
IOException:
if there is either an underlying I/O problem
convertNumberToBigDecimalback to summary
protected final void convertNumberToBigDecimal() throws IOException

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

Annotations
@Override
convertNumberToBigIntegerback to summary
protected final void convertNumberToBigInteger() throws IOException

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

Annotations
@Override
convertNumberToDoubleback to summary
protected final void convertNumberToDouble() throws IOException

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

Annotations
@Override
convertNumberToFloatback to summary
protected final void convertNumberToFloat() throws IOException

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

Annotations
@Override
convertNumberToIntback to summary
protected final void convertNumberToInt() throws IOException

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

Annotations
@Override
convertNumberToLongback to summary
protected final void convertNumberToLong() throws IOException

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

Annotations
@Override
decodeArrayNextback to summary
public abstract long decodeArrayNext() throws IOException
decodeArrayStartback to summary
public abstract long decodeArrayStart() throws IOException
decodeBooleanback to summary
public abstract JsonToken decodeBoolean() throws IOException
decodeBytesback to summary
public abstract JsonToken decodeBytes() throws IOException
decodeDoubleback to summary
public abstract JsonToken decodeDouble() throws IOException
decodeEnumback to summary
public abstract int decodeEnum() throws IOException
decodeFixedback to summary
public abstract JsonToken decodeFixed(int size) throws IOException
decodeFloatback to summary
public abstract JsonToken decodeFloat() throws IOException
decodeIndexback to summary
public abstract int decodeIndex() throws IOException
decodeIntback to summary
public abstract int decodeInt() throws IOException
decodeIntTokenback to summary
public abstract JsonToken decodeIntToken() throws IOException
decodeLongback to summary
public abstract long decodeLong() throws IOException
decodeLongTokenback to summary
public abstract JsonToken decodeLongToken() throws IOException
decodeMapKeyback to summary
public abstract String decodeMapKey() throws IOException
decodeMapNextback to summary
public abstract long decodeMapNext() throws IOException
decodeMapStartback to summary
public abstract long decodeMapStart() throws IOException
decodeStringback to summary
public abstract void decodeString() throws IOException
decodeStringTokenback to summary
public abstract JsonToken decodeStringToken() throws IOException
enumIndexback to summary
public final int enumIndex()
getFloatValueback to summary
public final float getFloatValue() throws IOException

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

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

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_FLOAT and it can be expressed as a Java float primitive type. It can also be called for JsonToken#VALUE_NUMBER_INT; if so, it is equivalent to calling getLongValue and then casting; except for possible overflow/underflow exception.

Note

if the value falls outside of range of Java float, a InputCoercionException will be thrown to indicate numeric overflow/underflow.

Returns:float

Current number value as float (if numeric token within Java float range); otherwise exception thrown

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
getNumberTypeback to summary
public final JsonParser.NumberType getNumberType() throws IOException

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

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

If current token is of type JsonToken#VALUE_NUMBER_INT or JsonToken#VALUE_NUMBER_FLOAT, returns one of NumberType constants; otherwise returns null.

Returns:JsonParser.NumberType

Type of current number, if parser points to numeric token; null otherwise

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
getNumberTypeFPback to summary
public JsonParser.NumberTypeFP getNumberTypeFP() throws IOException

Overrides com.fasterxml.jackson.core.JsonParser.getNumberTypeFP.

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

If current token is of type JsonToken#VALUE_NUMBER_FLOAT, returns one of NumberTypeFP constants; otherwise returns NumberTypeFP#UNKNOWN.

Default implementation as of Jackson 2.x will call getNumberType() and translate types -- this needs to be overriden actual implementations if this is not sufficient (which it usually is not for textual formats).

Returns:JsonParser.NumberTypeFP

Type of current floating-point number, if parser points to numeric token; NumberTypeFP#UNKNOWN otherwise.

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
getNumberValueback to summary
public final Number getNumberValue() throws IOException

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

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

Generic number value accessor method that will work for all kinds of numeric values. It will return the optimal (simplest/smallest possible) wrapper object that can express the numeric value just parsed.

Returns:Number

Numeric value of the current token in its most optimal representation

Annotations
@Override
Exceptions
IOException:
Problem with access: JsonParseException if the current token is not numeric, or if decoding of the value fails (invalid format for numbers); plain IOException if underlying content read fails (possible if values are extracted lazily)
getNumberValueExactback to summary
public final Number getNumberValueExact() throws IOException

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

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

Method similar to getNumberValue with the difference that for floating-point numbers value returned may be BigDecimal if the underlying format does not store floating-point numbers using native representation: for example, textual formats represent numbers as Strings (which are 10-based), and conversion to java.lang.Double is potentially lossy operation.

Default implementation simply returns getNumberValue()

Returns:Number

Numeric value of the current token using most accurate representation

Annotations
@Override
Exceptions
IOException:
Problem with access: JsonParseException if the current token is not numeric, or if decoding of the value fails (invalid format for numbers); plain IOException if underlying content read fails (possible if values are extracted lazily)
getRemainingElementsback to summary
public long getRemainingElements()

Returns the remaining number of elements in the current block of a map or array

isNaNback to summary
public final boolean isNaN()

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

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

Accessor for checking whether current token is a special "not-a-number" (NaN) token (including both "NaN" AND positive/negative infinity!). These values are not supported by all formats: JSON, for example, only supports them if JsonReadFeature#ALLOW_NON_NUMERIC_NUMBERS is enabled.

Note

in case where numeric value is outside range of requested type -- most notably java.lang.Float or java.lang.Double -- and decoding results effectively in a NaN value, this method DOES NOT return true: only explicit incoming markers do. This is because value could still be accessed as a valid BigDecimal.

Returns:boolean

True if the current token is reported as JsonToken#VALUE_NUMBER_FLOAT and represents a "Not a Number" value; false for other tokens and regular floating-point numbers.

Annotations
@Override
isRecordback to summary
public final boolean isRecord()
nextFieldNameback to summary
public String nextFieldName() throws IOException

Overrides com.fasterxml.jackson.core.JsonParser.nextFieldName.

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

Method that fetches next token (as if calling nextToken) and verifies whether it is JsonToken#FIELD_NAME; if it is, returns same as currentName(), otherwise null.

Returns:String

Name of the the JsonToken.FIELD_NAME parser advanced to, if any; null if next token is of some other type

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
nextFieldNameback to summary
public boolean nextFieldName(SerializableString sstr) throws IOException

Overrides com.fasterxml.jackson.core.JsonParser.nextFieldName.

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

Method that fetches next token (as if calling nextToken) and verifies whether it is JsonToken#FIELD_NAME with specified name and returns result of that comparison. It is functionally equivalent to:

  return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(currentName());
but may be faster for parser to verify, and can therefore be used if caller expects to get such a property name from input next.
Parameters
sstr:SerializableString

Property name to compare next token to (if next token is JsonToken.FIELD_NAME)

Returns:boolean

True if parser advanced to JsonToken.FIELD_NAME with specified name; false otherwise (different token or non-matching name)

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
nextTextValueback to summary
public abstract String nextTextValue() throws IOException

Overrides com.fasterxml.jackson.core.JsonParser.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
nextTokenback to summary
public JsonToken nextToken() throws IOException

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

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

Main iteration method, which will advance stream enough to determine type of the next token, if any. If none remaining (stream has no content other than possible white space before ending), null will be returned.

Returns:JsonToken

Next token from the stream, if any found, or null to indicate end-of-input

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
overrideFormatFeaturesback to summary
public final JsonParser overrideFormatFeatures(int values, int mask)

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

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

Bulk set method for (re)setting states of FormatFeatures, by specifying values (set / clear) along with a mask, to determine which features to change, if any.

Default implementation will simply throw an exception to indicate that the parser implementation does not support any FormatFeatures.

Parameters
values:int

Bit mask of set/clear state for features to change

mask:int

Bit mask of features to change

Returns:JsonParser

This parser, to allow call chaining

Annotations
@Override
setAvroContextback to summary
public final void setAvroContext(AvroReadContext ctxt)
setBytesback to summary
protected final JsonToken setBytes(byte[] b)
setNumberback to summary
protected final JsonToken setNumber(int v)
setNumberback to summary
protected final JsonToken setNumber(long v)
setNumberback to summary
protected final JsonToken setNumber(float v)
setNumberback to summary
protected final JsonToken setNumber(double v)
setStringback to summary
protected abstract JsonToken setString(String str) throws IOException
skipArrayback to summary
public abstract long skipArray() throws IOException
Returns:long

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

skipBooleanback to summary
public abstract void skipBoolean() throws IOException
skipBytesback to summary
public abstract void skipBytes() throws IOException
skipDoubleback to summary
public abstract void skipDouble() throws IOException
skipFixedback to summary
public abstract void skipFixed(int size) throws IOException
skipFloatback to summary
public abstract void skipFloat() throws IOException
skipIntback to summary
public abstract void skipInt() throws IOException
skipLongback to summary
public abstract void skipLong() throws IOException
skipMapback to summary
public abstract long skipMap() throws IOException
Returns:long

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

skipStringback to summary
public abstract void skipString() throws IOException
skipValueback to summary
public final void skipValue() throws IOException

Skip to the end of the current structure (array/map/object); This is different from skipMap() and skipArray() because it operates at the parser level instead of at the decoder level and advances the parsing context in addition to consuming the data from the input.

Exceptions
IOException:
If there was an issue advancing through the underlying data stream