public class NonBlockingJsonParser extends NonBlockingJsonParserBase implements ByteArrayFeeder
JsonParser.Feature, JsonParser.NumberType
Modifier and Type | Field and Description |
---|---|
protected static int[] |
_icLatin1 |
protected byte[] |
_inputBuffer
This buffer is actually provided via
NonBlockingInputFeeder |
protected int |
_origBufferLen
In addition to current buffer pointer, and end pointer,
we will also need to know number of bytes originally
contained.
|
_currBufferStart, _currInputRowAlt, _endOfInput, _majorState, _majorStateAfterValue, _minorState, _minorStateAfterSplit, _nonStdTokenType, _pending32, _pendingBytes, _quad1, _quadBuffer, _quadLength, _quoted32, _quotedDigits, _symbols, MAJOR_ARRAY_ELEMENT_FIRST, MAJOR_ARRAY_ELEMENT_NEXT, MAJOR_CLOSED, MAJOR_INITIAL, MAJOR_OBJECT_FIELD_FIRST, MAJOR_OBJECT_FIELD_NEXT, MAJOR_OBJECT_VALUE, MAJOR_ROOT, MINOR_COMMENT_C, MINOR_COMMENT_CLOSING_ASTERISK, MINOR_COMMENT_CPP, MINOR_COMMENT_LEADING_SLASH, MINOR_COMMENT_YAML, MINOR_FIELD_APOS_NAME, MINOR_FIELD_LEADING_COMMA, MINOR_FIELD_LEADING_WS, MINOR_FIELD_NAME, MINOR_FIELD_NAME_ESCAPE, MINOR_FIELD_UNQUOTED_NAME, MINOR_NUMBER_EXPONENT_DIGITS, MINOR_NUMBER_EXPONENT_MARKER, MINOR_NUMBER_FRACTION_DIGITS, MINOR_NUMBER_INTEGER_DIGITS, MINOR_NUMBER_MINUS, MINOR_NUMBER_MINUSZERO, MINOR_NUMBER_ZERO, MINOR_ROOT_BOM, MINOR_ROOT_GOT_SEPARATOR, MINOR_ROOT_NEED_SEPARATOR, MINOR_VALUE_APOS_STRING, MINOR_VALUE_EXPECTING_COLON, MINOR_VALUE_EXPECTING_COMMA, MINOR_VALUE_LEADING_WS, MINOR_VALUE_STRING, MINOR_VALUE_STRING_ESCAPE, MINOR_VALUE_STRING_UTF8_2, MINOR_VALUE_STRING_UTF8_3, MINOR_VALUE_STRING_UTF8_4, MINOR_VALUE_TOKEN_ERROR, MINOR_VALUE_TOKEN_FALSE, MINOR_VALUE_TOKEN_NON_STD, MINOR_VALUE_TOKEN_NULL, MINOR_VALUE_TOKEN_TRUE, MINOR_VALUE_WS_AFTER_COMMA, NON_STD_TOKEN_INFINITY, NON_STD_TOKEN_MINUS_INFINITY, NON_STD_TOKEN_NAN, NON_STD_TOKEN_PLUS_INFINITY, NON_STD_TOKEN_VALUES, NON_STD_TOKENS
_binaryValue, _byteArrayBuilder, _closed, _currInputProcessed, _currInputRow, _currInputRowStart, _expLength, _fractLength, _inputEnd, _inputPtr, _intLength, _ioContext, _nameCopied, _nameCopyBuffer, _nextToken, _numberBigDecimal, _numberBigInt, _numberDouble, _numberInt, _numberLong, _numberNegative, _numTypesValid, _parsingContext, _textBuffer, _tokenInputCol, _tokenInputRow, _tokenInputTotal
_currToken, _lastClearedToken, 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_SLASH, INT_SPACE, INT_TAB, MAX_ERROR_TOKEN_LENGTH, MAX_INT_D, MAX_INT_L, MAX_LONG_D, MIN_INT_D, MIN_INT_L, MIN_LONG_D, NO_BYTES, NO_INTS, NR_BIGDECIMAL, NR_BIGINT, NR_DOUBLE, NR_FLOAT, NR_INT, NR_LONG, NR_UNKNOWN
_features, _requestPayload
Constructor and Description |
---|
NonBlockingJsonParser(IOContext ctxt,
int parserFeatures,
ByteQuadsCanonicalizer sym) |
Modifier and Type | Method and Description |
---|---|
protected char |
_decodeEscaped()
Method that sub-classes must implement to support escaped sequences
in base64-encoded sections.
|
protected JsonToken |
_finishErrorToken() |
protected JsonToken |
_finishErrorTokenWithEOF() |
protected JsonToken |
_finishFieldWithEscape() |
protected JsonToken |
_finishFloatExponent(boolean checkSign,
int ch) |
protected JsonToken |
_finishFloatFraction() |
protected JsonToken |
_finishKeywordToken(String expToken,
int matched,
JsonToken result) |
protected JsonToken |
_finishKeywordTokenWithEOF(String expToken,
int matched,
JsonToken result) |
protected JsonToken |
_finishNonStdToken(int type,
int matched) |
protected JsonToken |
_finishNonStdTokenWithEOF(int type,
int matched) |
protected JsonToken |
_finishNumberIntegralPart(char[] outBuf,
int outPtr) |
protected JsonToken |
_finishNumberLeadingNegZeroes() |
protected JsonToken |
_finishNumberLeadingZeroes() |
protected JsonToken |
_finishNumberMinus(int ch) |
protected JsonToken |
_finishToken()
Method called when decoding of a token has been started, but not yet completed due
to missing input; method is to continue decoding due to at least one more byte
being made available to decode.
|
protected JsonToken |
_finishTokenWithEOF()
Method similar to
_finishToken() , but called when no more input is
available, and end-of-input has been detected. |
protected JsonToken |
_reportErrorToken(String actualToken) |
protected JsonToken |
_startAposString() |
protected JsonToken |
_startFalseToken() |
protected JsonToken |
_startFloat(char[] outBuf,
int outPtr,
int ch) |
protected JsonToken |
_startNegativeNumber() |
protected JsonToken |
_startNullToken() |
protected JsonToken |
_startNumberLeadingZero() |
protected JsonToken |
_startPositiveNumber(int ch) |
protected JsonToken |
_startString() |
protected JsonToken |
_startTrueToken() |
protected JsonToken |
_startUnexpectedValue(boolean leadingComma,
int ch) |
void |
endOfInput()
Method that should be called after last chunk of data to parse has been fed
(with
feedInput in sub-class); can be called regardless of what NonBlockingInputFeeder.needMoreInput()
returns. |
void |
feedInput(byte[] buf,
int start,
int end)
Method that can be called to feed more data, if (and only if)
NonBlockingInputFeeder.needMoreInput() returns true. |
ByteArrayFeeder |
getNonBlockingInputFeeder()
Method that will either return a feeder instance (if parser uses
non-blocking, aka asynchronous access); or
null for
parsers that use blocking I/O. |
boolean |
needMoreInput()
Method called to check whether it is ok to feed more data: parser returns true
if it has no more content to parse (and it is ok to feed more); otherwise false
(and no data should yet be fed).
|
JsonToken |
nextToken()
Main iteration method, which will advance stream enough
to determine type of the next token, if any.
|
int |
releaseBuffered(OutputStream out)
Method that can be called to push back any content that
has been read but not consumed by the parser.
|
_addName, _closeArrayScope, _closeInput, _closeObjectScope, _eofAsNextToken, _fieldComplete, _findName, _findName, _findName, _getText2, _nonStdToken, _padLastQuad, _releaseBuffers, _reportInvalidChar, _reportInvalidInitial, _reportInvalidOther, _reportInvalidOther, _startArrayScope, _startObjectScope, _updateTokenLocation, _valueComplete, _valueCompleteInt, _valueNonStdNumberComplete, canParseAsync, getBinaryValue, getCodec, getCurrentLocation, getEmbeddedObject, getInputSource, getText, getText, getTextCharacters, getTextLength, getTextOffset, getTokenLocation, getValueAsString, getValueAsString, hasTextCharacters, readBinaryValue, setCodec, symbolTableForTests
_checkStdFeatureChanges, _decodeBase64Escape, _decodeBase64Escape, _eofAsNextChar, _finishString, _getByteArrayBuilder, _getSourceReference, _handleBase64MissingPadding, _handleEOF, _handleUnrecognizedCharacterEscape, _parseIntValue, _parseNumericValue, _reportMismatchedEndMarker, _reportTooLongIntegral, _throwUnquotedSpace, _validJsonTokenList, _validJsonValueList, close, convertNumberToBigDecimal, convertNumberToBigInteger, convertNumberToDouble, convertNumberToInt, convertNumberToLong, disable, enable, getBigIntegerValue, getCurrentName, getCurrentValue, getDecimalValue, getDoubleValue, getFloatValue, getIntValue, getLongValue, getNumberType, getNumberValue, getParsingContext, getTokenCharacterOffset, getTokenColumnNr, getTokenLineNr, growArrayBy, isClosed, isNaN, loadMore, loadMoreGuaranteed, overrideCurrentName, overrideStdFeatures, reportInvalidBase64Char, reportInvalidBase64Char, reset, resetAsNaN, resetFloat, resetInt, setCurrentValue, setFeatureMask, version
_ascii, _asciiBytes, _constructError, _decodeBase64, _getCharDesc, _hasTextualNull, _longIntegerDesc, _longNumberDesc, _reportError, _reportError, _reportError, _reportInputCoercion, _reportInvalidEOF, _reportInvalidEOF, _reportInvalidEOF, _reportInvalidEOFInValue, _reportInvalidEOFInValue, _reportMissingRootWS, _reportUnexpectedChar, _throwInternal, _throwInvalidSpace, _wrapError, clearCurrentToken, currentToken, currentTokenId, getCurrentToken, getCurrentTokenId, getLastClearedToken, getValueAsBoolean, getValueAsDouble, getValueAsInt, getValueAsInt, getValueAsLong, getValueAsLong, hasCurrentToken, hasToken, hasTokenId, isExpectedStartArrayToken, isExpectedStartObjectToken, nextValue, reportInvalidNumber, reportOverflowInt, reportOverflowInt, reportOverflowInt, reportOverflowLong, reportOverflowLong, reportOverflowLong, reportUnexpectedNumberChar, skipChildren
_codec, _constructError, _reportUnsupportedOperation, canReadObjectId, canReadTypeId, canUseSchema, configure, currentName, finishToken, getBinaryValue, getBooleanValue, getByteValue, getFeatureMask, getFormatFeatures, getObjectId, getSchema, getShortValue, getTypeId, getValueAsBoolean, getValueAsDouble, isEnabled, isEnabled, nextBooleanValue, nextFieldName, nextFieldName, nextIntValue, nextLongValue, nextTextValue, overrideFormatFeatures, readBinaryValue, readValueAs, readValueAs, readValueAsTree, readValuesAs, readValuesAs, releaseBuffered, requiresCustomCodec, setRequestPayloadOnError, setRequestPayloadOnError, setRequestPayloadOnError, setSchema
protected static final int[] _icLatin1
protected byte[] _inputBuffer
NonBlockingInputFeeder
protected int _origBufferLen
public NonBlockingJsonParser(IOContext ctxt, int parserFeatures, ByteQuadsCanonicalizer sym)
public ByteArrayFeeder getNonBlockingInputFeeder()
JsonParser
null
for
parsers that use blocking I/O.getNonBlockingInputFeeder
in class JsonParser
public final boolean needMoreInput()
NonBlockingInputFeeder
needMoreInput
in interface NonBlockingInputFeeder
public void feedInput(byte[] buf, int start, int end) throws IOException
ByteArrayFeeder
NonBlockingInputFeeder.needMoreInput()
returns true.feedInput
in interface ByteArrayFeeder
buf
- Byte array that contains data to feed: caller must ensure data remains
stable until it is fully processed (which is true when NonBlockingInputFeeder.needMoreInput()
returns true)start
- Offset within array where input data to process startsend
- Offset after last byte contained in the input arrayIOException
- if the state is such that this method should not be called
(has not yet consumed existing input data, or has been marked as closed)public void endOfInput()
NonBlockingInputFeeder
feedInput
in sub-class); can be called regardless of what NonBlockingInputFeeder.needMoreInput()
returns. After calling this method, no more data can be fed; and parser assumes
no more data will be available.endOfInput
in interface NonBlockingInputFeeder
public int releaseBuffered(OutputStream out) throws IOException
JsonParser
releaseBuffered
in class NonBlockingJsonParserBase
OutputStream
;
otherwise number of bytes released (0 if there was nothing to release)IOException
- if write to stream threw exceptionprotected char _decodeEscaped() throws IOException
ParserBase
_decodeEscaped
in class ParserBase
IOException
public JsonToken nextToken() throws IOException
JsonParser
nextToken
in class ParserMinimalBase
IOException
protected final JsonToken _finishToken() throws IOException
IOException
protected final JsonToken _finishTokenWithEOF() throws IOException
_finishToken()
, but called when no more input is
available, and end-of-input has been detected. This is usually problem
case, but not always: root-level values may be properly terminated by
this, and similarly trailing white-space may have been skipped.IOException
protected JsonToken _startUnexpectedValue(boolean leadingComma, int ch) throws IOException
IOException
protected JsonToken _startFalseToken() throws IOException
IOException
protected JsonToken _startTrueToken() throws IOException
IOException
protected JsonToken _startNullToken() throws IOException
IOException
protected JsonToken _finishKeywordToken(String expToken, int matched, JsonToken result) throws IOException
IOException
protected JsonToken _finishKeywordTokenWithEOF(String expToken, int matched, JsonToken result) throws IOException
IOException
protected JsonToken _finishNonStdToken(int type, int matched) throws IOException
IOException
protected JsonToken _finishNonStdTokenWithEOF(int type, int matched) throws IOException
IOException
protected JsonToken _finishErrorToken() throws IOException
IOException
protected JsonToken _finishErrorTokenWithEOF() throws IOException
IOException
protected JsonToken _reportErrorToken(String actualToken) throws IOException
IOException
protected JsonToken _startPositiveNumber(int ch) throws IOException
IOException
protected JsonToken _startNegativeNumber() throws IOException
IOException
protected JsonToken _startNumberLeadingZero() throws IOException
IOException
protected JsonToken _finishNumberMinus(int ch) throws IOException
IOException
protected JsonToken _finishNumberLeadingZeroes() throws IOException
IOException
protected JsonToken _finishNumberLeadingNegZeroes() throws IOException
IOException
protected JsonToken _finishNumberIntegralPart(char[] outBuf, int outPtr) throws IOException
IOException
protected JsonToken _startFloat(char[] outBuf, int outPtr, int ch) throws IOException
IOException
protected JsonToken _finishFloatFraction() throws IOException
IOException
protected JsonToken _finishFloatExponent(boolean checkSign, int ch) throws IOException
IOException
protected final JsonToken _finishFieldWithEscape() throws IOException
IOException
protected JsonToken _startString() throws IOException
IOException
protected JsonToken _startAposString() throws IOException
IOException
Copyright © 2008–2019 FasterXML. All rights reserved.