Module tools.jackson.core
Package tools.jackson.core.json.async
Class NonBlockingByteArrayJsonParser
java.lang.Object
tools.jackson.core.JsonParser
tools.jackson.core.base.ParserMinimalBase
tools.jackson.core.base.ParserBase
tools.jackson.core.json.JsonParserBase
tools.jackson.core.json.async.NonBlockingJsonParserBase
tools.jackson.core.json.async.NonBlockingUtf8JsonParserBase
tools.jackson.core.json.async.NonBlockingByteArrayJsonParser
- All Implemented Interfaces:
Closeable,AutoCloseable,ByteArrayFeeder,NonBlockingInputFeeder,Versioned
public class NonBlockingByteArrayJsonParser
extends NonBlockingUtf8JsonParserBase
implements ByteArrayFeeder
Non-blocking parser implementation for JSON content that takes its input
via
byte[] passed.
NOTE: only supports parsing of UTF-8 encoded content (and 7-bit US-ASCII since it is strict subset of UTF-8): other encodings are not supported.
-
Nested Class Summary
Nested classes/interfaces inherited from class tools.jackson.core.JsonParser
JsonParser.NumberType, JsonParser.NumberTypeFP -
Field Summary
Fields inherited from class tools.jackson.core.json.async.NonBlockingUtf8JsonParserBase
_icLatin1, _origBufferLenFields inherited from class tools.jackson.core.json.async.NonBlockingJsonParserBase
_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_PROPERTY_FIRST, MAJOR_OBJECT_PROPERTY_NEXT, MAJOR_OBJECT_VALUE, MAJOR_ROOT, MINOR_COMMENT_C, MINOR_COMMENT_CLOSING_ASTERISK, MINOR_COMMENT_CPP, MINOR_COMMENT_LEADING_SLASH, MINOR_COMMENT_YAML, MINOR_NUMBER_EXPONENT_DIGITS, MINOR_NUMBER_EXPONENT_MARKER, MINOR_NUMBER_FRACTION_DIGITS, MINOR_NUMBER_INTEGER_DIGITS, MINOR_NUMBER_MINUS, MINOR_NUMBER_MINUSZERO, MINOR_NUMBER_PLUS, MINOR_NUMBER_ZERO, MINOR_PROPERTY_APOS_NAME, MINOR_PROPERTY_LEADING_COMMA, MINOR_PROPERTY_LEADING_WS, MINOR_PROPERTY_NAME, MINOR_PROPERTY_NAME_ESCAPE, MINOR_PROPERTY_UNQUOTED_NAME, 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_TOKENSFields 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
ConstructorsConstructorDescriptionNonBlockingByteArrayJsonParser(ObjectReadContext readCtxt, IOContext ctxt, int stdFeatures, int formatReadFeatures, ByteQuadsCanonicalizer sym) -
Method Summary
Modifier and TypeMethodDescriptionvoidfeedInput(byte[] buf, int start, int end) Method that can be called to feed more data, if (and only if)NonBlockingInputFeeder.needMoreInput()returns true.protected bytegetByteFromBuffer(int ptr) protected byteprotected intMethod that will either return a feeder instance (if parser uses non-blocking, aka asynchronous access); ornullfor parsers that use blocking I/O.intMethod that can be called to push back any content that has been read but not consumed by the parser.Methods inherited from class tools.jackson.core.json.async.NonBlockingUtf8JsonParserBase
_decodeEscaped, _finishErrorToken, _finishErrorTokenWithEOF, _finishFloatExponent, _finishFloatFraction, _finishKeywordToken, _finishKeywordTokenWithEOF, _finishNonStdToken, _finishNonStdTokenWithEOF, _finishNumberIntegralPart, _finishNumberLeadingNegZeroes, _finishNumberLeadingPosNegZeroes, _finishNumberLeadingPosZeroes, _finishNumberLeadingZeroes, _finishNumberMinus, _finishNumberPlus, _finishNumberPlusMinus, _finishPropertyWithEscape, _finishToken, _finishTokenWithEOF, _reportErrorToken, _startAposString, _startFalseToken, _startFloat, _startFloatThatStartsWithPeriod, _startNegativeNumber, _startNullToken, _startNumberLeadingZero, _startPositiveNumber, _startPositiveNumber, _startString, _startTrueToken, _startUnexpectedValue, endOfInput, needMoreInput, nextTokenMethods inherited from class tools.jackson.core.json.async.NonBlockingJsonParserBase
_addName, _closeArrayScope, _closeInput, _closeObjectScope, _currentLocationMinusOne, _eofAsNextToken, _fieldComplete, _findName, _findName, _findName, _getText2, _nonStdToken, _padLastQuad, _releaseBuffers, _reportInvalidChar, _reportInvalidInitial, _reportInvalidOther, _reportInvalidOther, _startArrayScope, _startObjectScope, _updateTokenLocation, _valueComplete, _valueCompleteInt, _valueNonStdNumberComplete, canParseAsync, currentLocation, currentTokenLocation, getBinaryValue, getEmbeddedObject, getString, getString, getStringCharacters, getStringLength, getStringOffset, getValueAsString, getValueAsString, hasStringCharacters, readBinaryValue, streamReadInputSource, symbolTableForTestsMethods inherited from class tools.jackson.core.json.JsonParserBase
_handleUnrecognizedCharacterEscape, _isAllowedCtrlCharRS, _parseIntValue, _parseNumericValue, _reportExtraEndMarker, _reportMismatchedEndMarker, _reportTooLongIntegral, _throwUnquotedSpace, _validJsonTokenList, _validJsonValueList, assignCurrentValue, createChildArrayContext, createChildObjectContext, currentName, currentNameInBuffer, currentValue, 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, finishToken, getBooleanValue, getByteValue, getLastClearedToken, getNumberTypeFP, getShortValue, getValueAsBoolean, getValueAsDouble, getValueAsInt, getValueAsInt, getValueAsLong, getValueAsLong, hasCurrentToken, hasToken, hasTokenId, isClosed, isEnabled, isExpectedNumberIntToken, isExpectedStartArrayToken, isExpectedStartObjectToken, nextName, nextName, nextNameMatch, nextValue, objectReadContext, readValueAs, readValueAs, readValueAs, readValueAsTree, skipChildren, streamReadConstraints, streamReadFeaturesMethods inherited from class tools.jackson.core.JsonParser
_constructReadException, _constructReadException, _constructReadException, _constructReadException, _constructReadException, _constructReadException, _reportUnsupportedOperation, canReadObjectId, canReadTypeId, getBinaryValue, getObjectId, getSchema, getText, getTextCharacters, getTextLength, getTextOffset, getTypeId, getValueAsBoolean, getValueAsDouble, nextBooleanValue, nextIntValue, nextLongValue, nextStringValue, readBinaryValue, releaseBufferedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface tools.jackson.core.async.NonBlockingInputFeeder
endOfInput, needMoreInput
-
Constructor Details
-
NonBlockingByteArrayJsonParser
public NonBlockingByteArrayJsonParser(ObjectReadContext readCtxt, IOContext ctxt, int stdFeatures, int formatReadFeatures, ByteQuadsCanonicalizer sym)
-
-
Method Details
-
nonBlockingInputFeeder
Description copied from class:JsonParserMethod that will either return a feeder instance (if parser uses non-blocking, aka asynchronous access); ornullfor parsers that use blocking I/O.- Overrides:
nonBlockingInputFeederin classJsonParser- Returns:
- Input feeder to use with non-blocking (async) parsing
-
feedInput
Description copied from interface:ByteArrayFeederMethod that can be called to feed more data, if (and only if)NonBlockingInputFeeder.needMoreInput()returns true.- Specified by:
feedInputin interfaceByteArrayFeeder- Parameters:
buf- Byte array that contains data to feed: caller must ensure data remains stable until it is fully processed (which is true whenNonBlockingInputFeeder.needMoreInput()returns true)start- Offset within array where input data to process startsend- Offset after last byte contained in the input array- Throws:
JacksonException- 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)
-
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.- Specified by:
releaseBufferedin classNonBlockingJsonParserBase- 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
-
getNextSignedByteFromBuffer
protected byte getNextSignedByteFromBuffer()- Specified by:
getNextSignedByteFromBufferin classNonBlockingUtf8JsonParserBase- Returns:
- next signed byte from the buffer
-
getNextUnsignedByteFromBuffer
protected int getNextUnsignedByteFromBuffer()- Specified by:
getNextUnsignedByteFromBufferin classNonBlockingUtf8JsonParserBase- Returns:
- next unsigned byte from the buffer
-
getByteFromBuffer
protected byte getByteFromBuffer(int ptr) - Specified by:
getByteFromBufferin classNonBlockingUtf8JsonParserBase- Parameters:
ptr- pointer to byte that is required- Returns:
- byte from the buffer at the given pointer
-