Class NonBlockingByteArrayParser
- java.lang.Object
-
- com.fasterxml.jackson.core.JsonParser
-
- com.fasterxml.jackson.core.base.ParserMinimalBase
-
- com.fasterxml.jackson.dataformat.smile.SmileParserBase
-
- com.fasterxml.jackson.dataformat.smile.async.NonBlockingParserBase
-
- com.fasterxml.jackson.dataformat.smile.async.NonBlockingByteArrayParser
-
- All Implemented Interfaces:
com.fasterxml.jackson.core.async.ByteArrayFeeder
,com.fasterxml.jackson.core.async.NonBlockingInputFeeder
,com.fasterxml.jackson.core.Versioned
,java.io.Closeable
,java.lang.AutoCloseable
public class NonBlockingByteArrayParser extends NonBlockingParserBase implements com.fasterxml.jackson.core.async.ByteArrayFeeder
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]
_inputBuffer
This buffer is actually provided viaNonBlockingInputFeeder
protected int
_origBufferLen
In addition to current buffer pointer, and end pointer, we will also need to know number of bytes originally contained.-
Fields inherited from class com.fasterxml.jackson.dataformat.smile.async.NonBlockingParserBase
_byteArrayBuilder, _endOfInput, _inputCopy, _inputCopyLen, _majorState, _majorStateAfterValue, _minorState, _pending32, _pending64, MAJOR_ARRAY_ELEMENT, MAJOR_CLOSED, MAJOR_INITIAL, MAJOR_OBJECT_FIELD, MAJOR_OBJECT_VALUE, MAJOR_ROOT, MINOR_FIELD_NAME_2BYTE, MINOR_FIELD_NAME_LONG, MINOR_FIELD_NAME_SHORT_ASCII, MINOR_FIELD_NAME_SHORT_UNICODE, MINOR_HEADER_INITIAL, MINOR_HEADER_INLINE, MINOR_VALUE_BINARY_7BIT_BODY, MINOR_VALUE_BINARY_7BIT_LEN, MINOR_VALUE_BINARY_RAW_BODY, MINOR_VALUE_BINARY_RAW_LEN, MINOR_VALUE_NUMBER_BIGDEC_BODY, MINOR_VALUE_NUMBER_BIGDEC_LEN, MINOR_VALUE_NUMBER_BIGDEC_SCALE, MINOR_VALUE_NUMBER_BIGINT_BODY, MINOR_VALUE_NUMBER_BIGINT_LEN, MINOR_VALUE_NUMBER_DOUBLE, MINOR_VALUE_NUMBER_FLOAT, MINOR_VALUE_NUMBER_INT, MINOR_VALUE_NUMBER_LONG, MINOR_VALUE_STRING_LONG_ASCII, MINOR_VALUE_STRING_LONG_UNICODE, MINOR_VALUE_STRING_SHARED_2BYTE, MINOR_VALUE_STRING_SHORT_ASCII, MINOR_VALUE_STRING_SHORT_UNICODE
-
Fields inherited from class com.fasterxml.jackson.dataformat.smile.SmileParserBase
_binaryValue, _closed, _currInputProcessed, _formatFeatures, _inputEnd, _inputPtr, _ioContext, _mayContainRawBinary, _nameCopied, _nameCopyBuffer, _numberBigDecimal, _numberBigInt, _numberDouble, _numberFloat, _numberInt, _numberLong, _numberType, _numTypesValid, _quad1, _quad2, _quad3, _quadBuffer, _seenNameCount, _seenNames, _seenStringValueCount, _seenStringValues, _streamReadContext, _symbols, _symbolsCanonical, _textBuffer, _tokenOffsetForTotal, DEFAULT_NAME_BUFFER_LENGTH, DEFAULT_STRING_VALUE_BUFFER_LENGTH, LONGEST_NON_CHUNKED_BINARY, NO_STRINGS, SMILE_READ_CAPABILITIES
-
Fields inherited from class com.fasterxml.jackson.core.base.ParserMinimalBase
_currToken, _lastClearedToken, _streamReadConstraints, _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_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
-
-
Constructor Summary
Constructors Constructor Description NonBlockingByteArrayParser(com.fasterxml.jackson.core.io.IOContext ctxt, int parserFeatures, int smileFeatures, com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer sym)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
_decode7BitEncoded()
protected boolean
_decode7BitEncodedTail(int bytesToDecode, int buffered)
private java.lang.String
_decodeASCIIText(byte[] inBuf, int inPtr, int len)
private java.lang.String
_decodeLongUnicodeName(byte[] inBuf, int inPtr, int len)
private java.lang.String
_decodeShortUnicodeText(byte[] inBuf, int inPtr, int len)
Helper method used to decode short Unicode string, length for which actual length (in bytes) is knownprivate int
_decodeUTF8_2(int c, int d)
private int
_decodeUTF8_3(int c, int d, int e)
private int
_decodeUTF8_4(int c, int d, int e, int f)
private int
_decodeVInt()
private com.fasterxml.jackson.core.JsonToken
_finish7BitBinaryBody()
private com.fasterxml.jackson.core.JsonToken
_finish7BitBinaryLen(int value, int bytesRead)
private com.fasterxml.jackson.core.JsonToken
_finishBigDecimalBody()
private com.fasterxml.jackson.core.JsonToken
_finishBigDecimalLen(int value, int bytesRead)
private com.fasterxml.jackson.core.JsonToken
_finishBigDecimalScale(int value, int bytesRead)
private com.fasterxml.jackson.core.JsonToken
_finishBigIntBody()
private com.fasterxml.jackson.core.JsonToken
_finishBigIntLen(int value, int bytesRead)
protected com.fasterxml.jackson.core.JsonToken
_finishDouble(long value, int bytesRead)
protected com.fasterxml.jackson.core.JsonToken
_finishFloat(int value, int bytesRead)
protected com.fasterxml.jackson.core.JsonToken
_finishHeader(int state)
Helper method that will decode information from a header block that has been detected.private com.fasterxml.jackson.core.JsonToken
_finishInt(int value, int bytesRead)
private com.fasterxml.jackson.core.JsonToken
_finishLong(long value, int bytesRead)
private com.fasterxml.jackson.core.JsonToken
_finishLongASCII()
private com.fasterxml.jackson.core.JsonToken
_finishLongFieldName(int outPtr)
private com.fasterxml.jackson.core.JsonToken
_finishLongUnicode()
private boolean
_finishPartialUnicodeChar()
private com.fasterxml.jackson.core.JsonToken
_finishRawBinaryBody()
private com.fasterxml.jackson.core.JsonToken
_finishRawBinaryLen(int value, int bytesRead)
protected com.fasterxml.jackson.core.JsonToken
_finishToken()
Method called when a (scalar) value type has been detected, but not all of contents have been decoded due to incomplete input available.private int
_fourBytesToInt(int ptr)
private com.fasterxml.jackson.core.JsonToken
_start7BitBinary()
private com.fasterxml.jackson.core.JsonToken
_startBigDecimal()
private com.fasterxml.jackson.core.JsonToken
_startBigInt()
protected com.fasterxml.jackson.core.JsonToken
_startDouble()
protected com.fasterxml.jackson.core.JsonToken
_startFieldName(int ch)
Method that handles initial token type recognition for token that has to be either FIELD_NAME or END_OBJECT.protected com.fasterxml.jackson.core.JsonToken
_startFloat()
private com.fasterxml.jackson.core.JsonToken
_startInt()
private com.fasterxml.jackson.core.JsonToken
_startLong()
private com.fasterxml.jackson.core.JsonToken
_startLongASCII()
protected com.fasterxml.jackson.core.JsonToken
_startLongUnicode()
protected com.fasterxml.jackson.core.JsonToken
_startRawBinary()
private com.fasterxml.jackson.core.JsonToken
_startShortASCII(int len)
private com.fasterxml.jackson.core.JsonToken
_startShortUnicode(int len)
private com.fasterxml.jackson.core.JsonToken
_startValue(int ch)
Helper method called to detect type of a value token (at any level), and possibly decode it if contained in input buffer.void
endOfInput()
void
feedInput(byte[] buf, int start, int end)
com.fasterxml.jackson.core.async.ByteArrayFeeder
getNonBlockingInputFeeder()
boolean
needMoreInput()
com.fasterxml.jackson.core.JsonToken
nextToken()
int
releaseBuffered(java.io.OutputStream out)
-
Methods inherited from class com.fasterxml.jackson.dataformat.smile.async.NonBlockingParserBase
_addDecodedToSymbols, _addSeenStringValue, _closeArrayScope, _closeInput, _closeObjectScope, _eofAsNextToken, _expandSeenNames, _findDecodedFromSymbols, _handleSharedName, _handleSharedString, _initByteArrayBuilder, _parseNumericValue, _releaseBuffers2, _reportInvalidInitial, _reportInvalidOther, _reportInvalidSharedName, _reportInvalidSharedStringValue, _reportMissingHeader, _startArrayScope, _startObjectScope, _valueComplete, canParseAsync, getBinaryValue, getCodec, getEmbeddedObject, getInputSource, getText, getText, getTextCharacters, getTextLength, getTextOffset, hasTextCharacters, readBinaryValue, setCodec, symbolTableForTests
-
Methods inherited from class com.fasterxml.jackson.dataformat.smile.SmileParserBase
_handleEOF, _releaseBuffers, _reportMismatchedEndMarker, _sourceReference, close, convertNumberToBigDecimal, convertNumberToBigInteger, convertNumberToDouble, convertNumberToFloat, convertNumberToInt, convertNumberToLong, currentLocation, currentName, currentTokenLocation, getBigIntegerValue, getCurrentLocation, getCurrentName, getDecimalValue, getDoubleValue, getFloatValue, getFormatFeatures, getIntValue, getLongValue, getNumberType, getNumberTypeFP, getNumberValue, getNumberValueExact, getParsingContext, getReadCapabilities, getTokenLocation, isClosed, isNaN, mayContainRawBinary, overrideCurrentName, overrideFormatFeatures, version
-
Methods inherited from class com.fasterxml.jackson.core.base.ParserMinimalBase
_ascii, _asciiBytes, _constructError, _currentLocationMinusOne, _decodeBase64, _getCharDesc, _hasTextualNull, _longIntegerDesc, _longNumberDesc, _nullSafeUpdateToken, _reportError, _reportError, _reportError, _reportInputCoercion, _reportInvalidEOF, _reportInvalidEOF, _reportInvalidEOFInValue, _reportMissingRootWS, _reportUnexpectedChar, _reportUnexpectedNumberChar, _throwInternal, _throwInternalReturnAny, _throwInvalidSpace, _updateToken, _updateTokenToNA, _updateTokenToNull, _wrapError, clearCurrentToken, currentToken, currentTokenCount, currentTokenId, getCurrentToken, getCurrentTokenId, getLastClearedToken, getValueAsBoolean, getValueAsDouble, getValueAsInt, getValueAsInt, getValueAsLong, getValueAsLong, getValueAsString, getValueAsString, hasCurrentToken, hasToken, hasTokenId, isExpectedNumberIntToken, isExpectedStartArrayToken, isExpectedStartObjectToken, nextValue, reportInvalidNumber, reportOverflowInt, reportOverflowInt, reportOverflowInt, reportOverflowLong, reportOverflowLong, reportOverflowLong, reportUnexpectedNumberChar, skipChildren, streamReadConstraints
-
Methods inherited from class com.fasterxml.jackson.core.JsonParser
_codec, _constructError, _constructReadException, _constructReadException, _constructReadException, _constructReadException, _constructReadException, _constructReadException, _reportUnsupportedOperation, assignCurrentValue, canReadObjectId, canReadTypeId, canUseSchema, configure, currentValue, disable, enable, finishToken, getBinaryValue, getBooleanValue, getByteValue, getCurrentValue, getFeatureMask, getNumberValueDeferred, getObjectId, getSchema, getShortValue, getTypeId, getValueAsBoolean, getValueAsDouble, isEnabled, isEnabled, nextBooleanValue, nextFieldName, nextFieldName, nextIntValue, nextLongValue, nextTextValue, overrideStdFeatures, readBinaryValue, readValueAs, readValueAs, readValueAsTree, readValuesAs, readValuesAs, releaseBuffered, requiresCustomCodec, setCurrentValue, setFeatureMask, setRequestPayloadOnError, setRequestPayloadOnError, setRequestPayloadOnError, setSchema
-
-
-
-
Field Detail
-
_inputBuffer
protected byte[] _inputBuffer
This buffer is actually provided viaNonBlockingInputFeeder
-
_origBufferLen
protected int _origBufferLen
In addition to current buffer pointer, and end pointer, we will also need to know number of bytes originally contained. This is needed to correctly update location information when the block has been completed.
-
-
Method Detail
-
getNonBlockingInputFeeder
public com.fasterxml.jackson.core.async.ByteArrayFeeder getNonBlockingInputFeeder()
- Overrides:
getNonBlockingInputFeeder
in classcom.fasterxml.jackson.core.JsonParser
-
needMoreInput
public final boolean needMoreInput()
- Specified by:
needMoreInput
in interfacecom.fasterxml.jackson.core.async.NonBlockingInputFeeder
-
feedInput
public void feedInput(byte[] buf, int start, int end) throws java.io.IOException
- Specified by:
feedInput
in interfacecom.fasterxml.jackson.core.async.ByteArrayFeeder
- Throws:
java.io.IOException
-
endOfInput
public void endOfInput()
- Specified by:
endOfInput
in interfacecom.fasterxml.jackson.core.async.NonBlockingInputFeeder
-
releaseBuffered
public int releaseBuffered(java.io.OutputStream out) throws java.io.IOException
- Specified by:
releaseBuffered
in classNonBlockingParserBase
- Throws:
java.io.IOException
-
nextToken
public com.fasterxml.jackson.core.JsonToken nextToken() throws java.io.IOException
- Specified by:
nextToken
in classcom.fasterxml.jackson.core.base.ParserMinimalBase
- Throws:
java.io.IOException
-
_finishToken
protected final com.fasterxml.jackson.core.JsonToken _finishToken() throws java.io.IOException
Method called when a (scalar) value type has been detected, but not all of contents have been decoded due to incomplete input available.- Throws:
java.io.IOException
-
_finishHeader
protected com.fasterxml.jackson.core.JsonToken _finishHeader(int state) throws java.io.IOException
Helper method that will decode information from a header block that has been detected.- Throws:
java.io.IOException
-
_startValue
private final com.fasterxml.jackson.core.JsonToken _startValue(int ch) throws java.io.IOException
Helper method called to detect type of a value token (at any level), and possibly decode it if contained in input buffer. Note that possible header has been ruled out by caller and is not checked here.- Throws:
java.io.IOException
-
_startFieldName
protected final com.fasterxml.jackson.core.JsonToken _startFieldName(int ch) throws java.io.IOException
Method that handles initial token type recognition for token that has to be either FIELD_NAME or END_OBJECT.- Throws:
java.io.IOException
-
_finishLongFieldName
private final com.fasterxml.jackson.core.JsonToken _finishLongFieldName(int outPtr) throws java.io.IOException
- Throws:
java.io.IOException
-
_startShortASCII
private final com.fasterxml.jackson.core.JsonToken _startShortASCII(int len) throws java.io.IOException
- Throws:
java.io.IOException
-
_startShortUnicode
private final com.fasterxml.jackson.core.JsonToken _startShortUnicode(int len) throws java.io.IOException
- Throws:
java.io.IOException
-
_startLongASCII
private final com.fasterxml.jackson.core.JsonToken _startLongASCII() throws java.io.IOException
- Throws:
java.io.IOException
-
_finishLongASCII
private final com.fasterxml.jackson.core.JsonToken _finishLongASCII() throws java.io.IOException
- Throws:
java.io.IOException
-
_startLongUnicode
protected final com.fasterxml.jackson.core.JsonToken _startLongUnicode() throws java.io.IOException
- Throws:
java.io.IOException
-
_finishLongUnicode
private final com.fasterxml.jackson.core.JsonToken _finishLongUnicode() throws java.io.IOException
- Throws:
java.io.IOException
-
_finishPartialUnicodeChar
private final boolean _finishPartialUnicodeChar() throws java.io.IOException
- Throws:
java.io.IOException
-
_decodeUTF8_2
private final int _decodeUTF8_2(int c, int d) throws java.io.IOException
- Throws:
java.io.IOException
-
_decodeUTF8_3
private final int _decodeUTF8_3(int c, int d, int e) throws java.io.IOException
- Throws:
java.io.IOException
-
_decodeUTF8_4
private final int _decodeUTF8_4(int c, int d, int e, int f) throws java.io.IOException
- Throws:
java.io.IOException
-
_startInt
private final com.fasterxml.jackson.core.JsonToken _startInt() throws java.io.IOException
- Throws:
java.io.IOException
-
_finishInt
private final com.fasterxml.jackson.core.JsonToken _finishInt(int value, int bytesRead) throws java.io.IOException
- Throws:
java.io.IOException
-
_startLong
private final com.fasterxml.jackson.core.JsonToken _startLong() throws java.io.IOException
- Throws:
java.io.IOException
-
_finishLong
private final com.fasterxml.jackson.core.JsonToken _finishLong(long value, int bytesRead) throws java.io.IOException
- Throws:
java.io.IOException
-
_startBigInt
private final com.fasterxml.jackson.core.JsonToken _startBigInt() throws java.io.IOException
- Throws:
java.io.IOException
-
_finishBigIntLen
private final com.fasterxml.jackson.core.JsonToken _finishBigIntLen(int value, int bytesRead) throws java.io.IOException
- Throws:
java.io.IOException
-
_finishBigIntBody
private final com.fasterxml.jackson.core.JsonToken _finishBigIntBody() throws java.io.IOException
- Throws:
java.io.IOException
-
_startFloat
protected final com.fasterxml.jackson.core.JsonToken _startFloat() throws java.io.IOException
- Throws:
java.io.IOException
-
_finishFloat
protected final com.fasterxml.jackson.core.JsonToken _finishFloat(int value, int bytesRead) throws java.io.IOException
- Throws:
java.io.IOException
-
_startDouble
protected final com.fasterxml.jackson.core.JsonToken _startDouble() throws java.io.IOException
- Throws:
java.io.IOException
-
_finishDouble
protected final com.fasterxml.jackson.core.JsonToken _finishDouble(long value, int bytesRead) throws java.io.IOException
- Throws:
java.io.IOException
-
_startBigDecimal
private final com.fasterxml.jackson.core.JsonToken _startBigDecimal() throws java.io.IOException
- Throws:
java.io.IOException
-
_finishBigDecimalScale
private final com.fasterxml.jackson.core.JsonToken _finishBigDecimalScale(int value, int bytesRead) throws java.io.IOException
- Throws:
java.io.IOException
-
_finishBigDecimalLen
private final com.fasterxml.jackson.core.JsonToken _finishBigDecimalLen(int value, int bytesRead) throws java.io.IOException
- Throws:
java.io.IOException
-
_finishBigDecimalBody
private final com.fasterxml.jackson.core.JsonToken _finishBigDecimalBody() throws java.io.IOException
- Throws:
java.io.IOException
-
_startRawBinary
protected final com.fasterxml.jackson.core.JsonToken _startRawBinary() throws java.io.IOException
- Throws:
java.io.IOException
-
_finishRawBinaryLen
private final com.fasterxml.jackson.core.JsonToken _finishRawBinaryLen(int value, int bytesRead) throws java.io.IOException
- Throws:
java.io.IOException
-
_finishRawBinaryBody
private final com.fasterxml.jackson.core.JsonToken _finishRawBinaryBody() throws java.io.IOException
- Throws:
java.io.IOException
-
_start7BitBinary
private final com.fasterxml.jackson.core.JsonToken _start7BitBinary() throws java.io.IOException
- Throws:
java.io.IOException
-
_finish7BitBinaryLen
private final com.fasterxml.jackson.core.JsonToken _finish7BitBinaryLen(int value, int bytesRead) throws java.io.IOException
- Throws:
java.io.IOException
-
_finish7BitBinaryBody
private final com.fasterxml.jackson.core.JsonToken _finish7BitBinaryBody() throws java.io.IOException
- Throws:
java.io.IOException
-
_decodeASCIIText
private final java.lang.String _decodeASCIIText(byte[] inBuf, int inPtr, int len) throws java.io.IOException
- Throws:
java.io.IOException
-
_decodeShortUnicodeText
private final java.lang.String _decodeShortUnicodeText(byte[] inBuf, int inPtr, int len) throws java.io.IOException
Helper method used to decode short Unicode string, length for which actual length (in bytes) is known- Parameters:
len
- Length between 1 and 64- Throws:
java.io.IOException
-
_decodeLongUnicodeName
private final java.lang.String _decodeLongUnicodeName(byte[] inBuf, int inPtr, int len) throws java.io.IOException
- Throws:
java.io.IOException
-
_fourBytesToInt
private final int _fourBytesToInt(int ptr) throws java.io.IOException
- Throws:
java.io.IOException
-
_decodeVInt
private final int _decodeVInt() throws java.io.IOException
- Throws:
java.io.IOException
-
_decode7BitEncoded
private final boolean _decode7BitEncoded() throws java.io.IOException
- Throws:
java.io.IOException
-
_decode7BitEncodedTail
protected final boolean _decode7BitEncodedTail(int bytesToDecode, int buffered) throws java.io.IOException
- Throws:
java.io.IOException
-
-