Top Description Fields Constructors Methods
tools.jackson.core.base

public abstract Class ParserBase

extends ParserMinimalBase
Class Inheritance
Known Direct Subclasses
tools.jackson.core.json.JsonParserBase
Imports
java.math.BigDecimal, .BigInteger, java.util.Arrays, tools.jackson.core.*, tools.jackson.core.exc.InputCoercionException, .JacksonIOException, .StreamConstraintsException, .StreamReadException, tools.jackson.core.io.ContentReference, .IOContext, .NumberInput, tools.jackson.core.util.ByteArrayBuilder, .TextBuffer

Intermediate base class used by many (but not all) Jackson JsonParser implementations. Contains most common things that are independent of actual underlying input source.

Field Summary

Modifier and TypeField and Description
protected byte[]
_binaryValue

We will hold on to decoded binary data, for duration of current event, so that multiple calls to getBinaryValue will not need to decode data more than once.

protected ByteArrayBuilder
_byteArrayBuilder

ByteArrayBuilder is needed if 'getBinaryValue' is called.

protected long
_currInputProcessed

Number of characters/bytes that were contained in previous blocks (blocks that were already processed prior to the current buffer).

protected int
_currInputRow

Current row location of current point in input buffer, starting from 1, if available.

protected int
_currInputRowStart

Current index of the first character of the current row in input buffer.

protected int
_expLength

Length of the exponent part of the number, if any, not including 'e' marker or sign, just digits.

protected int
_fractLength

Length of the fractional part (not including decimal point or exponent), in characters.

protected int
_inputEnd

Index of character after last available one in the buffer.

protected int
_inputPtr

Pointer to next available character in buffer

protected int
_intLength

Length of integer part of the number, in characters

protected BigDecimal
protected BigInteger
protected double
protected float
protected int
protected boolean
_numberIsNaN

Marker for explicit "Not a Number" (NaN) values that may be read by some formats: this includes positive and negative infinity, as well as "NaN" result for some arithmetic operations.

protected long
protected boolean
_numberNegative

Flag that indicates whether numeric value has a negative value.

protected String
_numberString

Textual number representation captured from input in cases lazy-parsing is desired.

protected int
_numTypesValid

Bitfield that indicates which numeric representations have been calculated for the current type

protected final TextBuffer
_textBuffer

Buffer that contains contents of String values, including property names if necessary (name split across boundary, contains escape sequence, or access needed to char array)

protected int
_tokenInputCol

Column on input row that current token starts; 0-based (although in the end it'll be converted to 1-based)

protected int
_tokenInputRow

Input row on which current token starts, 1-based

protected long
_tokenInputTotal

Total number of bytes/characters read before start of current token.

Inherited from tools.jackson.core.base.ParserMinimalBase:
_closed_currToken_ioContext_lastClearedToken_objectReadContext_streamReadConstraints_streamReadFeatures_tokenCount_trackMaxTokenCountBD_MAX_INTBD_MAX_LONGBD_MIN_INTBD_MIN_LONGBI_MAX_INTBI_MAX_LONGBI_MIN_INTBI_MIN_LONGCHAR_NULLINT_0INT_9INT_APOSINT_ASTERISKINT_BACKSLASHINT_COLONINT_COMMAINT_CRINT_eINT_EINT_HASHINT_LBRACKETINT_LCURLYINT_LFINT_MINUSINT_PERIODINT_PLUSINT_QUOTEINT_RBRACKETINT_RCURLYINT_RSINT_SLASHINT_SPACEINT_TABMAX_BYTE_IMAX_INT_DMAX_INT_LMAX_LONG_DMAX_SHORT_IMIN_BYTE_IMIN_INT_DMIN_INT_LMIN_LONG_DMIN_SHORT_INO_BYTESNO_INTSNR_BIGDECIMALNR_BIGINTNR_DOUBLENR_FLOATNR_INTNR_LONGNR_UNKNOWNSTREAM_READ_FEATURE_DEFAULTS

Constructor Summary

AccessConstructor and Description
protected
ParserBase(ObjectReadContext readCtxt, IOContext ctxt, int streamReadFeatures)

Method Summary

Modifier and TypeMethod and Description
protected ContentReference

Returns:

ContentReference object to use.
_contentReference
()

Helper method used to encapsulate logic of including (or not) of "content reference" when constructing TokenStreamLocation instances.

protected ContentReference

Returns:

ContentReference object to use when source is not to be included
_contentReferenceRedacted
()

Helper method used to encapsulate logic of providing "content reference" when constructing TokenStreamLocation instances and source information is NOT to be included (StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION disabled).

protected BigInteger
protected final int
_decodeBase64Escape(Base64Variant b64variant, int ch, int index)

protected final int
_decodeBase64Escape(Base64Variant b64variant, char ch, int index)

protected char

Returns:

Character decoded, if any
_decodeEscaped
()

Method that sub-classes must implement to support escaped sequences in base64-encoded sections.

protected final int

Returns:

If no exception is thrown, -1 which is used as marked for "end-of-input"
_eofAsNextChar
()

protected BigDecimal

Returns:

BigDecimal value decoded or converted for the current event
_getBigDecimal
()

Internal accessor that needs to be used for accessing number value of type BigDecimal which -- as of 2.14 -- is typically lazily parsed.

protected BigInteger

Returns:

BigInteger value decoded or converted for the current event
_getBigInteger
()

Internal accessor that needs to be used for accessing number value of type BigInteger which -- as of 2.14 -- is typically lazily parsed.

protected ByteArrayBuilder
protected double

Returns:

double value decoded or converted for the current event
_getNumberDouble
()

Internal accessor that needs to be used for accessing number value of type double which will be lazily parsed.

protected float

Returns:

float value decoded or converted for the current event
_getNumberFloat
()

Internal accessor that needs to be used for accessing number value of type float which will be lazily parsed.

protected int[]
_growNameDecodeBuffer(int[] arr, int more)

protected <T> T
protected void
_handleEOF()

Implements abstract tools.jackson.core.base.ParserMinimalBase._handleEOF.

Method called when an EOF is encountered between tokens.

protected abstract int
protected abstract void
_parseNumericValue(int
Numeric type that we will immediately need, if any; mostly necessary to optimize handling of floating point numbers
expType
)

Method that will parse actual numeric value out of a syntactically valid number value.

protected void
_releaseBuffers()

Implements abstract tools.jackson.core.base.ParserMinimalBase._releaseBuffers.

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

protected <T> T
_reportInvalidBase64Char(Base64Variant b64variant, int ch, int bindex)

protected <T> T
_reportInvalidBase64Char(Base64Variant b64variant, int ch, int bindex, String msg)

public void
assignCurrentValue(Object v)

Implements abstract tools.jackson.core.JsonParser.assignCurrentValue.

Helper method, usually equivalent to: getParsingContext().assignCurrentValue(v);

public void
close()

Overrides tools.jackson.core.base.ParserMinimalBase.close.

Implements java.io.Closeable.close.

Method that can be called to get the name associated with the current event.

protected void
protected void
protected void
protected void
protected void
protected void
public Object
currentValue()

Implements abstract tools.jackson.core.JsonParser.currentValue.

Helper method, usually equivalent to: getParsingContext().currentValue();

Note that "current value" is NOT populated (or used) by Streaming parser; it is only used by higher-level data-binding functionality.

public BigInteger
getBigIntegerValue()

Implements abstract tools.jackson.core.JsonParser.getBigIntegerValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_INT and it cannot be used as a Java long primitive type due to its magnitude.

public byte[]
getBinaryValue(Base64Variant variant)

Implements abstract tools.jackson.core.JsonParser.getBinaryValue.

Method that can be used to read (and consume -- results may not be accessible using other methods after the call) base64-encoded binary data included in the current textual JSON value.

public BigDecimal
getDecimalValue()

Implements abstract tools.jackson.core.JsonParser.getDecimalValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_FLOAT or JsonToken#VALUE_NUMBER_INT.

public double
getDoubleValue()

Implements abstract tools.jackson.core.JsonParser.getDoubleValue.

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 double primitive type.

public float
getFloatValue()

Implements abstract tools.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.

public int
getIntValue()

Implements abstract tools.jackson.core.JsonParser.getIntValue.

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

public long
getLongValue()

Implements abstract tools.jackson.core.JsonParser.getLongValue.

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

public JsonParser.NumberType
getNumberType()

Implements abstract tools.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.

public Number
getNumberValue()

Implements abstract tools.jackson.core.JsonParser.getNumberValue.

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

public Object
getNumberValueDeferred()

Overrides tools.jackson.core.base.ParserMinimalBase.getNumberValueDeferred.

Method similar to getNumberValue but that returns either same Number value as getNumberValue() (if already decoded), or String representation of as-of-yet undecoded number.

public Number
getNumberValueExact()

Overrides tools.jackson.core.base.ParserMinimalBase.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
public int
public int
protected static int[]
growArrayBy(int[] arr, int more)

public boolean
hasStringCharacters()

Implements abstract 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()).

public boolean
isNaN()

Implements abstract tools.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!).

protected final JsonToken
reset(boolean negative, int intLen, int fractLen, int expLen)

protected final JsonToken
resetAsNaN(String valueStr, double value)

protected final JsonToken
resetFloat(boolean negative, int intLen, int fractLen, int expLen)

protected final JsonToken
resetInt(boolean negative, int intLen)

Inherited from tools.jackson.core.base.ParserMinimalBase:
_closeInput_constructInputCoercion_constructNotNumericType_currentLocationMinusOne_decodeBase64_getCharDesc_hasTextualNull_longIntegerDesc_longNumberDesc_nullSafeUpdateToken_reportBadInputStream_reportBadReader_reportError_reportError_reportError_reportError_reportInvalidEOF_reportInvalidEOF_reportInvalidEOFInValue_reportInvalidNumber_reportInvalidSpace_reportMissingRootWS_reportOverflowByte_reportOverflowInt_reportOverflowInt_reportOverflowInt_reportOverflowLong_reportOverflowLong_reportOverflowLong_reportOverflowShort_reportUnexpectedChar_reportUnexpectedNumberChar_throwInternal_updateToken_updateTokenToNA_updateTokenToNull_wrapIOFailureclearCurrentTokencurrentNameMatchcurrentTokencurrentTokenCountcurrentTokenIdfinishTokengetBooleanValuegetByteValuegetEmbeddedObjectgetLastClearedTokengetNumberTypeFPgetShortValuegetStringgetValueAsBooleangetValueAsDoublegetValueAsIntgetValueAsIntgetValueAsLonggetValueAsLonggetValueAsStringgetValueAsStringhasCurrentTokenhasTokenhasTokenIdisClosedisEnabledisExpectedNumberIntTokenisExpectedStartArrayTokenisExpectedStartObjectTokennextNamenextNamenextNameMatchnextValueobjectReadContextreadValueAsreadValueAsreadValueAsreadValueAsTreeskipChildrenstreamReadCapabilitiesstreamReadConstraintsstreamReadFeatures

Field Detail

_binaryValueback to summary
protected byte[] _binaryValue

We will hold on to decoded binary data, for duration of current event, so that multiple calls to getBinaryValue will not need to decode data more than once.

_byteArrayBuilderback to summary
protected ByteArrayBuilder _byteArrayBuilder

ByteArrayBuilder is needed if 'getBinaryValue' is called. If so, we better reuse it for remainder of content.

_currInputProcessedback to summary
protected long _currInputProcessed

Number of characters/bytes that were contained in previous blocks (blocks that were already processed prior to the current buffer).

_currInputRowback to summary
protected int _currInputRow

Current row location of current point in input buffer, starting from 1, if available.

_currInputRowStartback to summary
protected int _currInputRowStart

Current index of the first character of the current row in input buffer. Needed to calculate column position, if necessary; benefit of not having column itself is that this only has to be updated once per line.

_expLengthback to summary
protected int _expLength

Length of the exponent part of the number, if any, not including 'e' marker or sign, just digits. Not used for pure integer values.

_fractLengthback to summary
protected int _fractLength

Length of the fractional part (not including decimal point or exponent), in characters. Not used for pure integer values.

_inputEndback to summary
protected int _inputEnd

Index of character after last available one in the buffer.

_inputPtrback to summary
protected int _inputPtr

Pointer to next available character in buffer

_intLengthback to summary
protected int _intLength

Length of integer part of the number, in characters

_numberBigDecimalback to summary
protected BigDecimal _numberBigDecimal
_numberBigIntback to summary
protected BigInteger _numberBigInt
_numberDoubleback to summary
protected double _numberDouble
_numberFloatback to summary
protected float _numberFloat
_numberIntback to summary
protected int _numberInt
_numberIsNaNback to summary
protected boolean _numberIsNaN

Marker for explicit "Not a Number" (NaN) values that may be read by some formats: this includes positive and negative infinity, as well as "NaN" result for some arithmetic operations.

In case of JSON, such values can only be handled with non-standard processing: for some other formats they can be passed normally.

Note

this marker is NOT set in case of value overflow/underflow for double or float values.

Since
2.17
_numberLongback to summary
protected long _numberLong
_numberNegativeback to summary
protected boolean _numberNegative

Flag that indicates whether numeric value has a negative value. That is, whether its textual representation starts with minus character.

_numberStringback to summary
protected String _numberString

Textual number representation captured from input in cases lazy-parsing is desired.

_numTypesValidback to summary
protected int _numTypesValid

Bitfield that indicates which numeric representations have been calculated for the current type

_textBufferback to summary
protected final TextBuffer _textBuffer

Buffer that contains contents of String values, including property names if necessary (name split across boundary, contains escape sequence, or access needed to char array)

_tokenInputColback to summary
protected int _tokenInputCol

Column on input row that current token starts; 0-based (although in the end it'll be converted to 1-based)

_tokenInputRowback to summary
protected int _tokenInputRow

Input row on which current token starts, 1-based

_tokenInputTotalback to summary
protected long _tokenInputTotal

Total number of bytes/characters read before start of current token. For big (gigabyte-sized) sizes are possible, needs to be long, unlike pointers and sizes related to in-memory buffers.

Constructor Detail

ParserBaseback to summary
protected ParserBase(ObjectReadContext readCtxt, IOContext ctxt, int streamReadFeatures)

Method Detail

_contentReferenceback to summary
protected ContentReference _contentReference()

Helper method used to encapsulate logic of including (or not) of "content reference" when constructing TokenStreamLocation instances.

Returns:ContentReference

ContentReference object to use.

_contentReferenceRedactedback to summary
protected ContentReference _contentReferenceRedacted()

Helper method used to encapsulate logic of providing "content reference" when constructing TokenStreamLocation instances and source information is NOT to be included (StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION disabled).

Default implementation will simply return ContentReference#redacted().

Returns:ContentReference

ContentReference object to use when source is not to be included

_convertBigDecimalToBigIntegerback to summary
protected BigInteger _convertBigDecimalToBigInteger(BigDecimal bigDec)
_decodeBase64Escapeback to summary
protected final int _decodeBase64Escape(Base64Variant b64variant, int ch, int index) throws JacksonException
_decodeBase64Escapeback to summary
protected final int _decodeBase64Escape(Base64Variant b64variant, char ch, int index) throws JacksonException
_decodeEscapedback to summary
protected char _decodeEscaped() throws JacksonException

Method that sub-classes must implement to support escaped sequences in base64-encoded sections. Sub-classes that do not need base64 support can leave this as is

Returns:char

Character decoded, if any

Exceptions
JacksonException:
If escape decoding fails
_eofAsNextCharback to summary
protected final int _eofAsNextChar() throws StreamReadException
Returns:int

If no exception is thrown, -1 which is used as marked for "end-of-input"

Exceptions
StreamReadException:
If check on _handleEOF() fails; usually because the current context is not root context (missing end markers in content)
_getBigDecimalback to summary
protected BigDecimal _getBigDecimal()

Internal accessor that needs to be used for accessing number value of type BigDecimal which -- as of 2.14 -- is typically lazily parsed.

Returns:BigDecimal

BigDecimal value decoded or converted for the current event

_getBigIntegerback to summary
protected BigInteger _getBigInteger()

Internal accessor that needs to be used for accessing number value of type BigInteger which -- as of 2.14 -- is typically lazily parsed.

Returns:BigInteger

BigInteger value decoded or converted for the current event

_getByteArrayBuilderback to summary
protected ByteArrayBuilder _getByteArrayBuilder()
_getNumberDoubleback to summary
protected double _getNumberDouble()

Internal accessor that needs to be used for accessing number value of type double which will be lazily parsed.

Returns:double

double value decoded or converted for the current event

_getNumberFloatback to summary
protected float _getNumberFloat()

Internal accessor that needs to be used for accessing number value of type float which will be lazily parsed.

Returns:float

float value decoded or converted for the current event

Since
2.15
_growNameDecodeBufferback to summary
protected int[] _growNameDecodeBuffer(int[] arr, int more) throws StreamConstraintsException
_handleBase64MissingPaddingback to summary
protected <T> T _handleBase64MissingPadding(Base64Variant b64variant) throws StreamReadException
_handleEOFback to summary
protected void _handleEOF() throws JacksonException

Implements abstract tools.jackson.core.base.ParserMinimalBase._handleEOF.

Method called when an EOF is encountered between tokens. If so, it may be a legitimate EOF, but only if there is no open non-root context.

Annotations
@Override
Exceptions
JacksonException:

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

if end-of-content not allowed at current position.

_parseIntValueback to summary
protected abstract int _parseIntValue() throws JacksonException
_parseNumericValueback to summary
protected abstract void _parseNumericValue(int expType) throws JacksonException, InputCoercionException

Method that will parse actual numeric value out of a syntactically valid number value. Type it will parse into depends on whether it is a floating point number, as well as its magnitude: smallest legal type (of ones available) is used for efficiency.

Parameters
expType:int

Numeric type that we will immediately need, if any; mostly necessary to optimize handling of floating point numbers

Exceptions
InputCoercionException:
if the current token not of numeric type
JacksonIOException:
for low-level read issues
StreamReadException:
for number decoding problems
_releaseBuffersback to summary
protected void _releaseBuffers()

Implements abstract tools.jackson.core.base.ParserMinimalBase._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
_reportInvalidBase64Charback to summary
protected <T> T _reportInvalidBase64Char(Base64Variant b64variant, int ch, int bindex) throws StreamReadException
_reportInvalidBase64Charback to summary
protected <T> T _reportInvalidBase64Char(Base64Variant b64variant, int ch, int bindex, String msg) throws StreamReadException
assignCurrentValueback to summary
public void assignCurrentValue(Object v)

Implements abstract tools.jackson.core.JsonParser.assignCurrentValue.

Doc from tools.jackson.core.JsonParser.assignCurrentValue.

Helper method, usually equivalent to: getParsingContext().assignCurrentValue(v);

Annotations
@Override
closeback to summary
public void close() throws JacksonException

Overrides tools.jackson.core.base.ParserMinimalBase.close.

Implements java.io.Closeable.close.

Method that can be called to get the name associated with the current event.

Annotations
@Override
convertNumberToBigDecimalback to summary
protected void convertNumberToBigDecimal()
convertNumberToBigIntegerback to summary
protected void convertNumberToBigInteger()
convertNumberToDoubleback to summary
protected void convertNumberToDouble()
convertNumberToFloatback to summary
protected void convertNumberToFloat()
convertNumberToIntback to summary
protected void convertNumberToInt() throws InputCoercionException
convertNumberToLongback to summary
protected void convertNumberToLong() throws InputCoercionException
currentValueback to summary
public Object currentValue()

Implements abstract tools.jackson.core.JsonParser.currentValue.

Doc from tools.jackson.core.JsonParser.currentValue.

Helper method, usually equivalent to: getParsingContext().currentValue();

Note that "current value" is NOT populated (or used) by Streaming parser; it is only used by higher-level data-binding functionality. The reason it is included here is that it can be stored and accessed hierarchically, and gets passed through data-binding.

Annotations
@Override
getBigIntegerValueback to summary
public BigInteger getBigIntegerValue() throws JacksonException

Implements abstract tools.jackson.core.JsonParser.getBigIntegerValue.

Doc from tools.jackson.core.JsonParser.getBigIntegerValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_INT and it cannot be used as a Java long primitive type due to its magnitude. It can also be called for JsonToken#VALUE_NUMBER_FLOAT; if so, it is equivalent to calling getDecimalValue and then constructing a BigInteger from that value.

Annotations
@Override
getBinaryValueback to summary
public byte[] getBinaryValue(Base64Variant variant) throws JacksonException

Implements abstract tools.jackson.core.JsonParser.getBinaryValue.

Doc from tools.jackson.core.JsonParser.getBinaryValue.

Method that can be used to read (and consume -- results may not be accessible using other methods after the call) base64-encoded binary data included in the current textual JSON value. It works similar to getting String value via getString() and decoding result (except for decoding part), but should be significantly more performant.

Note that non-decoded textual contents of the current token are not guaranteed to be accessible after this method is called. Current implementation, for example, clears up textual content during decoding. Decoded binary content, however, will be retained until parser is advanced to the next event.

Annotations
@SuppressWarnings:resource
@Override
getDecimalValueback to summary
public BigDecimal getDecimalValue() throws JacksonException

Implements abstract tools.jackson.core.JsonParser.getDecimalValue.

Doc from tools.jackson.core.JsonParser.getDecimalValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_FLOAT or JsonToken#VALUE_NUMBER_INT. No under/overflow exceptions are ever thrown.

Annotations
@Override
getDoubleValueback to summary
public double getDoubleValue() throws JacksonException

Implements abstract tools.jackson.core.JsonParser.getDoubleValue.

Doc from tools.jackson.core.JsonParser.getDoubleValue.

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 double 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 double, a InputCoercionException will be thrown to indicate numeric overflow/underflow.

Annotations
@Override
getFloatValueback to summary
public float getFloatValue() throws JacksonException

Implements abstract tools.jackson.core.JsonParser.getFloatValue.

Doc from tools.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.

Annotations
@Override
getIntValueback to summary
public int getIntValue() throws JacksonException

Implements abstract tools.jackson.core.JsonParser.getIntValue.

Doc from tools.jackson.core.JsonParser.getIntValue.

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

Note

if the resulting integer value falls outside range of Java int, a InputCoercionException may be thrown to indicate numeric overflow/underflow.

Annotations
@Override
getLongValueback to summary
public long getLongValue() throws JacksonException

Implements abstract tools.jackson.core.JsonParser.getLongValue.

Doc from tools.jackson.core.JsonParser.getLongValue.

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

Note

if the token is an integer, but its value falls outside of range of Java long, a InputCoercionException may be thrown to indicate numeric overflow/underflow.

Annotations
@Override
getNumberTypeback to summary
public JsonParser.NumberType getNumberType()

Implements abstract tools.jackson.core.JsonParser.getNumberType.

Doc from tools.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.

Note

in Jackson 2.x, an exception was wrong if called for non-numeric token.

Annotations
@Override
getNumberValueback to summary
public Number getNumberValue()

Implements abstract tools.jackson.core.JsonParser.getNumberValue.

Doc from tools.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.

Annotations
@Override
getNumberValueDeferredback to summary
public Object getNumberValueDeferred()

Overrides tools.jackson.core.base.ParserMinimalBase.getNumberValueDeferred.

Doc from tools.jackson.core.JsonParser.getNumberValueDeferred.

Method similar to getNumberValue but that returns either same Number value as getNumberValue() (if already decoded), or String representation of as-of-yet undecoded number. Typically textual formats allow deferred decoding from String, whereas binary formats either decode numbers eagerly or have binary representation from which to decode value to return.

Same constraints apply to calling this method as to getNumberValue(): current token must be either JsonToken#VALUE_NUMBER_INT or JsonToken#VALUE_NUMBER_FLOAT; otherwise an exception is thrown

Default implementation simply returns getNumberValue()

Annotations
@Override
getNumberValueExactback to summary
public Number getNumberValueExact()

Overrides tools.jackson.core.base.ParserMinimalBase.getNumberValueExact.

Doc from tools.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()

Annotations
@Override
getTokenCharacterOffsetback to summary
public long getTokenCharacterOffset()
getTokenColumnNrback to summary
public int getTokenColumnNr()
getTokenLineNrback to summary
public int getTokenLineNr()
growArrayByback to summary
protected static int[] growArrayBy(int[] arr, int more) throws IllegalArgumentException
hasStringCharactersback to summary
public boolean hasStringCharacters()

Implements abstract tools.jackson.core.JsonParser.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
isNaNback to summary
public boolean isNaN()

Implements abstract tools.jackson.core.JsonParser.isNaN.

Doc from tools.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.

Annotations
@Override
resetback to summary
protected final JsonToken reset(boolean negative, int intLen, int fractLen, int expLen) throws JacksonException
resetAsNaNback to summary
protected final JsonToken resetAsNaN(String valueStr, double value)
resetFloatback to summary
protected final JsonToken resetFloat(boolean negative, int intLen, int fractLen, int expLen) throws JacksonException
resetIntback to summary
protected final JsonToken resetInt(boolean negative, int intLen) throws JacksonException