- All Implemented Interfaces:
Closeable,AutoCloseable,Versioned
JsonParser, which is
based on a InputStream as the input source.-
Nested Class Summary
Nested classes/interfaces inherited from class tools.jackson.core.JsonParser
JsonParser.NumberType, JsonParser.NumberTypeFP -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanFlag that indicates whether the input buffer is recycable (and needs to be returned to recycler once we are done) or not.protected static final int[]protected byte[]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 InputStreamprotected intprotected intValue ofParserBase._inputPtrat the time when the first character of name token was read.protected intprotected int[]Temporary buffer used for name parsing.protected final ByteQuadsCanonicalizerSymbol table that contains property names encountered so farprotected booleanFlag that indicates that the current token has not yet been fully processed, and needs to be finished for some access (or skipped to obtain the next token)Fields inherited from class tools.jackson.core.json.JsonParserBase
_formatReadFeatures, _nameCopied, _nextToken, _streamReadContextFields inherited from class tools.jackson.core.base.ParserBase
_binaryValue, _byteArrayBuilder, _currInputProcessed, _currInputRow, _currInputRowStart, _expLength, _fractLength, _inputEnd, _inputPtr, _intLength, _numberBigDecimal, _numberBigInt, _numberDouble, _numberFloat, _numberInt, _numberIsNaN, _numberLong, _numberNegative, _numberString, _numTypesValid, _textBuffer, _tokenInputCol, _tokenInputRow, _tokenInputTotalFields inherited from class tools.jackson.core.base.ParserMinimalBase
_closed, _currToken, _ioContext, _lastClearedToken, _objectReadContext, _streamReadConstraints, _streamReadFeatures, _tokenCount, _trackMaxTokenCount, BD_MAX_INT, BD_MAX_LONG, BD_MIN_INT, BD_MIN_LONG, BI_MAX_INT, BI_MAX_LONG, BI_MIN_INT, BI_MIN_LONG, CHAR_NULL, INT_0, INT_9, INT_APOS, INT_ASTERISK, INT_BACKSLASH, INT_COLON, INT_COMMA, INT_CR, INT_e, INT_E, INT_HASH, INT_LBRACKET, INT_LCURLY, INT_LF, INT_MINUS, INT_PERIOD, INT_PLUS, INT_QUOTE, INT_RBRACKET, INT_RCURLY, INT_RS, INT_SLASH, INT_SPACE, INT_TAB, MAX_BYTE_I, MAX_INT_D, MAX_INT_L, MAX_LONG_D, MAX_SHORT_I, MIN_BYTE_I, MIN_INT_D, MIN_INT_L, MIN_LONG_D, MIN_SHORT_I, NO_BYTES, NO_INTS, NR_BIGDECIMAL, NR_BIGINT, NR_DOUBLE, NR_FLOAT, NR_INT, NR_LONG, NR_UNKNOWN, STREAM_READ_FEATURE_DEFAULTSFields inherited from class tools.jackson.core.JsonParser
DEFAULT_READ_CAPABILITIES -
Constructor Summary
ConstructorsConstructorDescriptionUTF8StreamJsonParser(ObjectReadContext readCtxt, IOContext ctxt, int stdFeatures, int formatReadFeatures, InputStream in, ByteQuadsCanonicalizer sym, byte[] inputBuffer, int start, int end, int bytesPreProcessed, boolean bufferRecyclable) Constructor called when caller wants to provide input buffer directly (or needs to, in case of bootstrapping having read some of contents) and it may or may not be recyclable use standard recycle context. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAbstract method for sub-classes to implement; to be called byParserMinimalBase.close()implementation here.protected TokenStreamLocationFactory method used to provide location for cases where we must read and consume a single "wrong" character (to possibly allow error recovery), but need to report accurate location for that character: if so, the current location is past location we want, and location we want will be "one location earlier".protected final byte[]_decodeBase64(Base64Variant b64variant) Efficient handling for incremental parsing of base64-encoded textual content.protected int_decodeCharForError(int firstByte) protected charMethod that sub-classes must implement to support escaped sequences in base64-encoded sections.protected Stringprotected voidprotected final Stringprotected JsonTokenprotected JsonToken_handleInvalidNumberStart(int ch, boolean neg) protected JsonToken_handleInvalidNumberStart(int ch, boolean neg, boolean hasSign) protected String_handleOddName(int ch) Method called when we see non-white space character other than double quote, when expecting a property name.protected JsonToken_handleUnexpectedValue(int c) Method for handling cases where first non-space character of an expected value token is not legal for standard JSON content.protected final booleanprotected voidprotected final voidprotected final int_matchLongName(PropertyNameMatcher matcher, int qptr, int q) protected final int_matchMediumName(PropertyNameMatcher matcher, int qptr, int q2) protected final int_matchMediumName2(PropertyNameMatcher matcher, int qptr, int q3, int q2) protected final int_matchName(PropertyNameMatcher matcher, int i) protected final voidprotected final void_matchToken(String matchStr, int i) protected final voidprotected Stringprotected final JsonToken_parseFloatThatStartsWithPeriod(boolean neg, boolean hasSign) protected final String_parseName(int i) protected JsonToken_parseUnsignedNumber(int c) Initial parsing method for number values.protected int_readBinary(Base64Variant b64variant, OutputStream out, byte[] buffer) protected voidMethod called to release internal buffers owned by the base reader.protected <T> T_reportInvalidChar(int c) protected <T> T_reportInvalidInitial(int mask) protected <T> T_reportInvalidOther(int mask) protected <T> T_reportInvalidOther(int mask, int ptr) protected <T> T_reportInvalidToken(String matchedPart) protected <T> T_reportInvalidToken(String matchedPart, int ptr) protected <T> T_reportInvalidToken(String matchedPart, String msg) protected final void_skipCR()protected voidMethod called to skim through rest of unparsed String value, if it is not needed.Method that returns location of the last processed character; usually for error reporting purposes.Method that return the starting location of the current token; that is, position of the first character from input that starts the current token.voidMethod that may be used to force full handling of the current token so that even if lazy processing is enabled, the whole contents are read for possible retrieval.byte[]getBinaryValue(Base64Variant b64variant) 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.Method for accessing textual representation of the current token; if no current token (before first call toJsonParser.nextToken(), or after encountering end-of-input), returns null.intMethod to read the textual representation of the current token in chunks and pass it to the given Writer.char[]Method similar toJsonParser.getString(), but that will return underlying (unmodifiable) character array that contains textual value, instead of constructing a String object to contain this information.intAccessor used withJsonParser.getStringCharacters(), to know length of String stored in returned buffer.intAccessor used withJsonParser.getStringCharacters(), to know offset of the first text content character within buffer.intMethod that will try to convert value of current token to a Javaintvalue.intgetValueAsInt(int defValue) Method that will try to convert value of current token to aint.Method that will try to convert value of current token to aString.getValueAsString(String defValue) Method that will try to convert value of current token to aString.Method that fetches next token (as if callingJsonParser.nextToken()) and if it isJsonToken.VALUE_TRUEorJsonToken.VALUE_FALSEreturns matching Boolean value; otherwise return null.intnextIntValue(int defaultValue) Method that fetches next token (as if callingJsonParser.nextToken()) and if it isJsonToken.VALUE_NUMBER_INTreturns 32-bit int value; otherwise returns specified default value It is functionally equivalent to:longnextLongValue(long defaultValue) Method that fetches next token (as if callingJsonParser.nextToken()) and if it isJsonToken.VALUE_NUMBER_INTreturns 64-bit long value; otherwise returns specified default value It is functionally equivalent to:nextName()Method that fetches next token (as if callingJsonParser.nextToken()) and verifies whether it isJsonToken.PROPERTY_NAME; if it is, returns same asJsonParser.currentName(), otherwise null.booleanMethod that fetches next token (as if callingJsonParser.nextToken()) and verifies whether it isJsonToken.PROPERTY_NAMEwith specified name and returns result of that comparison.intnextNameMatch(PropertyNameMatcher matcher) Method that tries to match next token from stream asJsonToken.PROPERTY_NAME, and if so, further match it to one of pre-specified (field) names.Method that fetches next token (as if callingJsonParser.nextToken()) and if it isJsonToken.VALUE_STRINGreturns contained String value; otherwise returns null.Main iteration method, which will advance stream enough to determine type of the next token, if any.protected final StringparseEscapedName(int[] quads, int qlen, int currQuad, int ch, int currQuadBytes) protected final StringparseLongName(int q, int q2, int q3) protected final StringparseMediumName(int q2) protected final StringparseMediumName2(int q3, int q2) intreadBinaryValue(Base64Variant b64variant, OutputStream out) Similar toJsonParser.readBinaryValue(OutputStream)but allows explicitly specifying base64 variant to use.intMethod that can be called to push back any content that has been read but not consumed by the parser.protected StringMethod that can be used to get access to object that is used to access input being parsed; this is usually eitherInputStreamorReader, depending on what parser was constructed with.Methods inherited from class tools.jackson.core.json.JsonParserBase
_handleUnrecognizedCharacterEscape, _isAllowedCtrlCharRS, _parseIntValue, _parseNumericValue, _reportExtraEndMarker, _reportMismatchedEndMarker, _reportTooLongIntegral, _throwUnquotedSpace, _validJsonTokenList, _validJsonValueList, assignCurrentValue, createChildArrayContext, createChildObjectContext, currentName, currentNameInBuffer, currentValue, hasStringCharacters, isEnabled, streamReadCapabilities, streamReadContext, versionMethods inherited from class tools.jackson.core.base.ParserBase
_contentReference, _contentReferenceRedacted, _convertBigDecimalToBigInteger, _decodeBase64Escape, _decodeBase64Escape, _eofAsNextChar, _getBigDecimal, _getBigInteger, _getByteArrayBuilder, _getNumberDouble, _getNumberFloat, _growNameDecodeBuffer, _handleBase64MissingPadding, _handleEOF, _reportInvalidBase64Char, _reportInvalidBase64Char, close, convertNumberToBigDecimal, convertNumberToBigInteger, convertNumberToDouble, convertNumberToFloat, convertNumberToInt, convertNumberToLong, getBigIntegerValue, getDecimalValue, getDoubleValue, getFloatValue, getIntValue, getLongValue, getNumberType, getNumberValue, getNumberValueDeferred, getNumberValueExact, getTokenCharacterOffset, getTokenColumnNr, getTokenLineNr, growArrayBy, isNaN, reset, resetAsNaN, resetFloat, resetIntMethods inherited from class tools.jackson.core.base.ParserMinimalBase
_constructInputCoercion, _constructNotNumericType, _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, _wrapIOFailure, clearCurrentToken, currentNameMatch, currentToken, currentTokenCount, currentTokenId, getBooleanValue, getByteValue, getEmbeddedObject, getLastClearedToken, getNumberTypeFP, getShortValue, getValueAsBoolean, getValueAsDouble, getValueAsLong, getValueAsLong, hasCurrentToken, hasToken, hasTokenId, isClosed, isEnabled, isExpectedNumberIntToken, isExpectedStartArrayToken, isExpectedStartObjectToken, nextValue, objectReadContext, readValueAs, readValueAs, readValueAs, readValueAsTree, skipChildren, streamReadConstraints, streamReadFeaturesMethods inherited from class tools.jackson.core.JsonParser
_constructReadException, _constructReadException, _constructReadException, _constructReadException, _constructReadException, _constructReadException, _reportUnsupportedOperation, canParseAsync, canReadObjectId, canReadTypeId, getBinaryValue, getObjectId, getSchema, getText, getTextCharacters, getTextLength, getTextOffset, getTypeId, getValueAsBoolean, getValueAsDouble, nonBlockingInputFeeder, readBinaryValue, releaseBuffered
-
Field Details
-
_icLatin1
protected static final int[] _icLatin1 -
_symbols
Symbol table that contains property names encountered so far -
_quadBuffer
protected int[] _quadBufferTemporary buffer used for name parsing. -
_tokenIncomplete
protected boolean _tokenIncompleteFlag that indicates that the current token has not yet been fully processed, and needs to be finished for some access (or skipped to obtain the next token) -
_nameStartOffset
protected int _nameStartOffsetValue ofParserBase._inputPtrat the time when the first character of name token was read. Used for calculating token location when requested; combined withParserBase._currInputProcessed, may be updated appropriately as needed. -
_nameStartRow
protected int _nameStartRow -
_nameStartCol
protected int _nameStartCol -
_inputStream
-
_inputBuffer
protected byte[] _inputBufferCurrent 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. -
_bufferRecyclable
protected boolean _bufferRecyclableFlag 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 CANNOT modify underlying buffer.
-
-
Constructor Details
-
UTF8StreamJsonParser
public UTF8StreamJsonParser(ObjectReadContext readCtxt, IOContext ctxt, int stdFeatures, int formatReadFeatures, InputStream in, ByteQuadsCanonicalizer sym, byte[] inputBuffer, int start, int end, int bytesPreProcessed, boolean bufferRecyclable) Constructor called when caller wants to provide input buffer directly (or needs to, in case of bootstrapping having read some of contents) and it may or may not be recyclable use standard recycle context.- Parameters:
readCtxt- Object read context to usectxt- I/O context to usestdFeatures- Standard stream read features enabledformatReadFeatures- Format-specific read features enabledin- InputStream used for reading actual content, if any;nullif nonesym- Name canonicalizer to useinputBuffer- Input buffer to read initial content from (before Reader)start- Pointer ininputBufferthat has the first content character to decodeend- Pointer past the last content character ininputBufferbytesPreProcessed- Number of bytes that have been consumed already (by bootstrapping)bufferRecyclable- WhetherinputBufferpassed is managed by Jackson core (and thereby needs recycling)
-
-
Method Details
-
releaseBuffered
Description copied from class:JsonParserMethod 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 cannot.- Overrides:
releaseBufferedin classJsonParser- Parameters:
out- OutputStream to which buffered, undecoded content is written to- Returns:
- -1 if the underlying content source is not byte based
(that is, input cannot be sent to
OutputStream; otherwise number of bytes released (0 if there was nothing to release) - Throws:
JacksonException- if write to stream threw exception
-
streamReadInputSource
Description copied from class:JsonParserMethod that can be used to get access to object that is used to access input being parsed; this is usually eitherInputStreamorReader, depending on what parser was constructed with. Note that returned value may be null in some cases; including case where parser implementation does not want to exposed raw source to caller. In cases where input has been decorated, object returned here is the decorated version; this allows some level of interaction between users of parser and decorator object.In general use of this accessor should be considered as "last effort", i.e. only used if no other mechanism is applicable.
NOTE: was named
getInputSource()in Jackson 2.x.- Specified by:
streamReadInputSourcein classJsonParser- Returns:
- Input source this parser was configured with
-
_loadMore
- Throws:
JacksonException
-
_closeInput
protected void _closeInput()Description copied from class:ParserMinimalBaseAbstract method for sub-classes to implement; to be called byParserMinimalBase.close()implementation here.- Specified by:
_closeInputin classParserMinimalBase
-
_releaseBuffers
protected void _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).- Overrides:
_releaseBuffersin classParserBase
-
getString
Description copied from class:JsonParserMethod for accessing textual representation of the current token; if no current token (before first call toJsonParser.nextToken(), or after encountering end-of-input), returns null. Method can be called for any token type.- Specified by:
getStringin classJsonParser- Returns:
- String value associated with the current token (one returned
by
JsonParser.nextToken()or other iteration methods) - Throws:
JacksonIOException- for low-level read issuesStreamReadException- for decoding problemsJacksonException
-
getString
Description copied from class:JsonParserMethod to read the textual representation of the current token in chunks and pass it to the given Writer. Functionally same as calling:writer.write(parser.getString());
but should typically be more efficient as longer content does need to be combined into a singleStringto return, and write can occur directly from intermediate buffers Jackson uses.NOTE: String value will still be buffered (usually using
TextBuffer) and will be accessible with othergetString()calls (that is, it will not be consumed). So this accessor only avoids construction ofStringcompared to plainJsonParser.getString()method.NOTE: In Jackson 2.x this method was called
getString(Writer).- Overrides:
getStringin classParserMinimalBase- Parameters:
writer- Writer to write String value to- Returns:
- The number of characters written to the Writer
- Throws:
JacksonIOException- for low-level read issues, or failed write usingWriterStreamReadException- for decoding problemsJacksonException
-
getValueAsString
Description copied from class:JsonParserMethod that will try to convert value of current token to aString. JSON Strings map naturally; scalar values get converted to their textual representation. If representation cannot be converted to a String value (including structured types like Objects and Arrays andnulltoken), default value of null will be returned; no exceptions are thrown.- Overrides:
getValueAsStringin classParserMinimalBase- Returns:
Stringvalue current token is converted to, if possible;nullotherwise- Throws:
JacksonException
-
getValueAsString
Description copied from class:JsonParserMethod that will try to convert value of current token to aString. JSON Strings map naturally; scalar values get converted to their textual representation. If representation cannot be converted to a String value (including structured types like Objects and Arrays andnulltoken), specified default value will be returned; no exceptions are thrown.- Overrides:
getValueAsStringin classParserMinimalBase- Parameters:
defValue- Default value to return if conversion toStringis not possible- Returns:
Stringvalue current token is converted to, if possible;defotherwise- Throws:
JacksonException
-
getValueAsInt
Description copied from class:JsonParserMethod that will try to convert value of current token to a Javaintvalue. Numbers are coerced using default Java rules; booleans convert to 0 (false) and 1 (true), and Strings are parsed using default Java language integer parsing rules.If representation cannot be converted to an int (including structured type markers like start/end Object/Array) default value of 0 will be returned; no exceptions are thrown.
- Overrides:
getValueAsIntin classParserMinimalBase- Returns:
intvalue current token is converted to, if possible; default value otherwise otherwise- Throws:
InputCoercionException- If numeric value exceedsintrangeJacksonException
-
getValueAsInt
Description copied from class:JsonParserMethod that will try to convert value of current token to aint. Numbers are coerced using default Java rules; booleans convert to 0 (false) and 1 (true), and Strings are parsed using default Java language integer parsing rules.If representation cannot be converted to an
int(including structured type markers like start/end Object/Array) specified def will be returned; no exceptions are thrown.- Overrides:
getValueAsIntin classParserMinimalBase- Parameters:
defValue- Default value to return if conversion tointis not possible- Returns:
intvalue current token is converted to, if possible;defotherwise- Throws:
InputCoercionException- If numeric value exceedsintrangeJacksonException
-
_getText2
- Throws:
JacksonException
-
getStringCharacters
Description copied from class:JsonParserMethod similar toJsonParser.getString(), but that will return underlying (unmodifiable) character array that contains textual value, instead of constructing a String object to contain this information. Note, however, that:- String contents are not guaranteed to start at
index 0 (rather, call
JsonParser.getStringOffset()) to know the actual offset - Length of string contents may be less than the
length of returned buffer: call
JsonParser.getStringLength()for actual length of returned content.
Note that caller MUST NOT modify the returned character array in any way -- doing so may corrupt current parser state and render parser instance useless.
The only reason to call this method (over
JsonParser.getString()) is to avoid construction of a String object (which will make a copy of contents).- Specified by:
getStringCharactersin classJsonParser- Returns:
- Buffer that contains the current textual value (but not necessarily at offset 0, and not necessarily until the end of buffer)
- Throws:
JacksonIOException- for low-level read issuesStreamReadException- for decoding problemsJacksonException
- String contents are not guaranteed to start at
index 0 (rather, call
-
getStringLength
Description copied from class:JsonParserAccessor used withJsonParser.getStringCharacters(), to know length of String stored in returned buffer.- Specified by:
getStringLengthin classJsonParser- Returns:
- Number of characters within buffer returned
by
JsonParser.getStringCharacters()that are part of textual content of the current token. - Throws:
JacksonIOException- for low-level read issuesStreamReadException- for decoding problemsJacksonException
-
getStringOffset
Description copied from class:JsonParserAccessor used withJsonParser.getStringCharacters(), to know offset of the first text content character within buffer.- Specified by:
getStringOffsetin classJsonParser- Returns:
- Offset of the first character within buffer returned
by
JsonParser.getStringCharacters()that is part of textual content of the current token. - Throws:
JacksonIOException- for low-level read issuesStreamReadException- for decoding problemsJacksonException
-
getBinaryValue
Description copied from class:JsonParserMethod 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 viaJsonParser.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.
- Overrides:
getBinaryValuein classParserBase- Parameters:
b64variant- Expected variant of base64 encoded content (seeBase64Variantsfor definitions of "standard" variants).- Returns:
- Decoded binary data
- Throws:
JacksonIOException- for low-level read issuesStreamReadException- for decoding problemsJacksonException
-
readBinaryValue
Description copied from class:JsonParserSimilar toJsonParser.readBinaryValue(OutputStream)but allows explicitly specifying base64 variant to use.- Overrides:
readBinaryValuein classJsonParser- Parameters:
b64variant- base64 variant to useout- Output stream to use for passing decoded binary data- Returns:
- Number of bytes that were decoded and written via
OutputStream - Throws:
JacksonIOException- for low-level read issuesStreamReadException- for decoding problemsJacksonException
-
_readBinary
protected int _readBinary(Base64Variant b64variant, OutputStream out, byte[] buffer) throws IOException - Throws:
IOException
-
nextToken
Description copied from class:JsonParserMain 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.- Specified by:
nextTokenin classJsonParser- Returns:
- Next token from the stream, if any found, or null to indicate end-of-input
- Throws:
JacksonException- for low-level read issuesStreamReadException- for decoding problems
-
finishToken
Description copied from class:JsonParserMethod that may be used to force full handling of the current token so that even if lazy processing is enabled, the whole contents are read for possible retrieval. This is usually used to ensure that the token end location is available, as well as token contents (similar to what calling, sayJsonParser.getStringCharacters(), would achieve).Note that for many dataformat implementations this method will not do anything; this is the default implementation unless overridden by sub-classes.
- Overrides:
finishTokenin classParserMinimalBase- Throws:
JacksonException- for low-level read issuesStreamReadException- for decoding problems
-
nextName
Description copied from class:JsonParserMethod that fetches next token (as if callingJsonParser.nextToken()) and verifies whether it isJsonToken.PROPERTY_NAME; if it is, returns same asJsonParser.currentName(), otherwise null.NOTE: in Jackson 2.x method was called
nextFieldName()- Overrides:
nextNamein classParserMinimalBase- Returns:
- Name of the the
JsonToken.PROPERTY_NAMEparser advanced to, if any;nullif next token is of some other type - Throws:
JacksonException- for low-level read issuesStreamReadException- for decoding problems
-
nextName
Description copied from class:JsonParserMethod that fetches next token (as if callingJsonParser.nextToken()) and verifies whether it isJsonToken.PROPERTY_NAMEwith specified name and returns result of that comparison. It is functionally equivalent to:return (nextToken() == JsonToken.PROPERTY_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.NOTE: in Jackson 2.x method was called
nextFieldName()- Overrides:
nextNamein classParserMinimalBase- Parameters:
str- Property name to compare next token to (if next token isJsonToken.PROPERTY_NAME)- Returns:
Trueif parser advanced toJsonToken.PROPERTY_NAMEwith specified name;falseotherwise (different token or non-matching name)- Throws:
JacksonException- for low-level read issuesStreamReadException- for decoding problems
-
nextNameMatch
Description copied from class:JsonParserMethod that tries to match next token from stream asJsonToken.PROPERTY_NAME, and if so, further match it to one of pre-specified (field) names. If match succeeds, property index (non-negative `int`) is returned; otherwise one of marker constants fromPropertyNameMatcher.- Overrides:
nextNameMatchin classParserMinimalBase- Parameters:
matcher- Matcher that will handle actual matching- Returns:
- Index of the matched property name, if non-negative, or a negative error
code otherwise (see
PropertyNameMatcherfor details) - Throws:
JacksonIOException- for low-level read issuesStreamReadException- for decoding problemsJacksonException
-
_matchName
- Throws:
JacksonException
-
_matchMediumName
protected final int _matchMediumName(PropertyNameMatcher matcher, int qptr, int q2) throws JacksonException - Throws:
JacksonException
-
_matchMediumName2
protected final int _matchMediumName2(PropertyNameMatcher matcher, int qptr, int q3, int q2) throws JacksonException - Throws:
JacksonException
-
_matchLongName
protected final int _matchLongName(PropertyNameMatcher matcher, int qptr, int q) throws JacksonException - Throws:
JacksonException
-
nextStringValue
Description copied from class:JsonParserMethod that fetches next token (as if callingJsonParser.nextToken()) and if it isJsonToken.VALUE_STRINGreturns contained String value; otherwise returns null. It is functionally equivalent to:return (nextToken() == JsonToken.VALUE_STRING) ? getString() : null;
but may be faster for parser to process, and can therefore be used if caller expects to get a String value next from input.- Overrides:
nextStringValuein classJsonParser- Returns:
- String value of
JsonToken.VALUE_STRINGtoken parser advanced to; ornullif next token is of some other type - Throws:
JacksonIOException- for low-level read issuesStreamReadException- for decoding problemsJacksonException
-
nextIntValue
Description copied from class:JsonParserMethod that fetches next token (as if callingJsonParser.nextToken()) and if it isJsonToken.VALUE_NUMBER_INTreturns 32-bit int value; otherwise returns specified default value It is functionally equivalent to:return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getIntValue() : defaultValue;
but may be faster for parser to process, and can therefore be used if caller expects to get an int value next from input.NOTE: value checks are performed similar to
JsonParser.getIntValue()- Overrides:
nextIntValuein classJsonParser- Parameters:
defaultValue- Value to return if next token is NOT of typeJsonToken.VALUE_NUMBER_INT- Returns:
- Integer (
int) value of theJsonToken.VALUE_NUMBER_INTtoken parser advanced to; ordefaultValueif next token is of some other type - Throws:
JacksonException- for low-level read issuesStreamReadException- for decoding problemsInputCoercionException- if integer number does not fit in Javaint
-
nextLongValue
Description copied from class:JsonParserMethod that fetches next token (as if callingJsonParser.nextToken()) and if it isJsonToken.VALUE_NUMBER_INTreturns 64-bit long value; otherwise returns specified default value It is functionally equivalent to:return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getLongValue() : defaultValue;
but may be faster for parser to process, and can therefore be used if caller expects to get a long value next from input.NOTE: value checks are performed similar to
JsonParser.getLongValue()- Overrides:
nextLongValuein classJsonParser- Parameters:
defaultValue- Value to return if next token is NOT of typeJsonToken.VALUE_NUMBER_INT- Returns:
longvalue of theJsonToken.VALUE_NUMBER_INTtoken parser advanced to; ordefaultValueif next token is of some other type- Throws:
JacksonIOException- for low-level read issuesStreamReadException- for decoding problemsInputCoercionException- if integer number does not fit in JavalongJacksonException
-
nextBooleanValue
Description copied from class:JsonParserMethod that fetches next token (as if callingJsonParser.nextToken()) and if it isJsonToken.VALUE_TRUEorJsonToken.VALUE_FALSEreturns matching Boolean value; otherwise return null. It is functionally equivalent to:JsonToken t = nextToken(); if (t == JsonToken.VALUE_TRUE) return Boolean.TRUE; if (t == JsonToken.VALUE_FALSE) return Boolean.FALSE; return null;
but may be faster for parser to process, and can therefore be used if caller expects to get a Boolean value next from input.- Overrides:
nextBooleanValuein classJsonParser- Returns:
Booleanvalue of theJsonToken.VALUE_TRUEorJsonToken.VALUE_FALSEtoken parser advanced to; ornullif next token is of some other type- Throws:
JacksonIOException- for low-level read issuesStreamReadException- for decoding problemsJacksonException
-
_parseFloatThatStartsWithPeriod
protected final JsonToken _parseFloatThatStartsWithPeriod(boolean neg, boolean hasSign) throws JacksonException - Throws:
JacksonException
-
_parseUnsignedNumber
Initial parsing method for number values. It needs to be able to parse enough input to be able to determine whether the value is to be considered a simple integer value, or a more generic decimal value: latter of which needs to be expressed as a floating point number. The basic rule is that if the number has no fractional or exponential part, it is an integer; otherwise a floating point number.Because much of input has to be processed in any case, no partial parsing is done: all input text will be stored for further processing. However, actual numeric value conversion will be deferred, since it is usually the most complicated and costliest part of processing.
- Parameters:
c- The first non-null digit character of the number to parse- Returns:
- Type of token decoded, usually
JsonToken.VALUE_NUMBER_INTorJsonToken.VALUE_NUMBER_FLOAT - Throws:
JacksonIOException- for low-level read issuesStreamReadException- for decoding problemsJacksonException
-
_parseName
- Throws:
JacksonException
-
parseMediumName
- Throws:
JacksonException
-
parseMediumName2
- Throws:
JacksonException
-
parseLongName
- Throws:
JacksonException
-
slowParseName
- Throws:
JacksonException
-
parseEscapedName
protected final String parseEscapedName(int[] quads, int qlen, int currQuad, int ch, int currQuadBytes) throws JacksonException - Throws:
JacksonException
-
_handleOddName
Method called when we see non-white space character other than double quote, when expecting a property name. In standard mode will just throw an exception; but in non-standard modes may be able to parse name.- Parameters:
ch- First undecoded character of possible "odd name" to decode- Returns:
- Name decoded, if allowed and successful
- Throws:
JacksonIOException- for low-level read issuesStreamReadException- for decoding problems (invalid name)JacksonException
-
_parseAposName
- Throws:
JacksonException
-
_loadMoreGuaranteed
- Throws:
JacksonException
-
_finishString
- Throws:
JacksonException
-
_finishAndReturnString
- Throws:
JacksonException
-
_skipString
Method called to skim through rest of unparsed String value, if it is not needed. This can be done bit faster if contents need not be stored for future access.- Throws:
JacksonIOException- for low-level read issuesStreamReadException- for decoding problems (invalid String value)JacksonException
-
_handleUnexpectedValue
Method for handling cases where first non-space character of an expected value token is not legal for standard JSON content.- Parameters:
c- First undecoded character of possible "odd value" to decode- Returns:
- Type of value decoded, if allowed and successful
- Throws:
JacksonIOException- for low-level read issuesStreamReadException- for decoding problemsJacksonException
-
_handleApos
- Throws:
JacksonException
-
_handleInvalidNumberStart
- Throws:
JacksonException
-
_handleInvalidNumberStart
protected JsonToken _handleInvalidNumberStart(int ch, boolean neg, boolean hasSign) throws JacksonException - Throws:
JacksonException
-
_matchTrue
- Throws:
JacksonException
-
_matchFalse
- Throws:
JacksonException
-
_matchNull
- Throws:
JacksonException
-
_matchToken
- Throws:
JacksonException
-
_decodeEscaped
Description copied from class:ParserBaseMethod 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- Overrides:
_decodeEscapedin classParserBase- Returns:
- Character decoded, if any
- Throws:
JacksonException- If escape decoding fails
-
_decodeCharForError
- Throws:
JacksonException
-
_skipCR
- Throws:
JacksonException
-
_reportInvalidToken
- Throws:
JacksonException
-
_reportInvalidToken
- Throws:
JacksonException
-
_reportInvalidToken
- Throws:
JacksonException
-
_reportInvalidChar
- Throws:
StreamReadException
-
_reportInvalidInitial
- Throws:
StreamReadException
-
_reportInvalidOther
- Throws:
StreamReadException
-
_reportInvalidOther
- Throws:
StreamReadException
-
_decodeBase64
Efficient handling for incremental parsing of base64-encoded textual content.- Parameters:
b64variant- Type of base64 encoding expected in context- Returns:
- Fully decoded value of base64 content
- Throws:
JacksonIOException- for low-level read issuesStreamReadException- for decoding problems (invalid content)JacksonException
-
currentTokenLocation
Description copied from class:JsonParserMethod that return the starting location of the current token; that is, position of the first character from input that starts the current token.Note that the location is not guaranteed to be accurate (although most implementation will try their best): some implementations may only return
TokenStreamLocation.NAdue to not having access to input location information (when delegating actual decoding work to other library).- Specified by:
currentTokenLocationin classJsonParser- Returns:
- Starting location of the token parser currently points to
-
currentLocation
Description copied from class:JsonParserMethod that returns location of the last processed character; usually for error reporting purposes.Note that the location is not guaranteed to be accurate (although most implementation will try their best): some implementations may only report specific boundary locations (start or end locations of tokens) and others only return
TokenStreamLocation.NAdue to not having access to input location information (when delegating actual decoding work to other library).- Specified by:
currentLocationin classJsonParser- Returns:
- Location of the last processed input unit (byte or character)
-
_currentLocationMinusOne
Description copied from class:ParserMinimalBaseFactory method used to provide location for cases where we must read and consume a single "wrong" character (to possibly allow error recovery), but need to report accurate location for that character: if so, the current location is past location we want, and location we want will be "one location earlier".Default implementation simply returns
JsonParser.currentLocation()- Overrides:
_currentLocationMinusOnein classParserMinimalBase- Returns:
- Same as
JsonParser.currentLocation()except offset by -1
-