Class SmileParser
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.SmileParser
- All Implemented Interfaces:
com.fasterxml.jackson.core.Versioned,Closeable,AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration that defines all togglable features for Smile generators.Nested classes/interfaces inherited from class com.fasterxml.jackson.core.JsonParser
com.fasterxml.jackson.core.JsonParser.NumberType -
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 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 InputStreamInput stream that can be used for reading more content, if one in use.protected com.fasterxml.jackson.core.ObjectCodecCodec used for data binding when (if) requested.protected 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)protected intType byte of the current token (as in)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, _parsingContext, _quad1, _quad2, _quad3, _quadBuffer, _seenNameCount, _seenNames, _seenStringValueCount, _seenStringValues, _smileBufferRecycler, _smileRecyclerRef, _symbols, _textBuffer, _tokenOffsetForTotal, NO_STRINGSFields inherited from class com.fasterxml.jackson.core.base.ParserMinimalBase
_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_UNKNOWNFields inherited from class com.fasterxml.jackson.core.JsonParser
_features, _requestPayload -
Constructor Summary
ConstructorsConstructorDescriptionSmileParser(com.fasterxml.jackson.core.io.IOContext ctxt, int parserFeatures, int smileFeatures, com.fasterxml.jackson.core.ObjectCodec codec, com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer sym, InputStream in, byte[] inputBuffer, int start, int end, boolean bufferRecyclable) -
Method Summary
Modifier and TypeMethodDescriptionprivate final String_addDecodedToSymbols(int len, String name) private final com.fasterxml.jackson.core.JsonTokenprotected voidprivate final voidprivate final voidprivate final String_decodeLongUnicodeName(int[] quads, int byteLen, int quadLen) private final String_decodeShortAsciiName(int len) protected final String_decodeShortAsciiValue(int len) private final String_decodeShortUnicodeName(int len) Helper method used to decode short Unicode string, length for which actual length (in bytes) is knownprotected final String_decodeShortUnicodeValue(int len) private final int_decodeUtf8_2(int c) private final int_decodeUtf8_3(int c1) private final int_decodeUtf8_3fast(int c1) private final int_decodeUtf8_4(int c) private final com.fasterxml.jackson.core.JsonTokenprivate final String[]_expandSeenNames(String[] oldShared) Method called to try to expand shared name area to fit one more potentially shared String.private final void_expandSeenStringValues(String newText) private final String_findDecodedFromSymbols(int len) Helper method for trying to find specified encoded UTF-8 byte sequence from symbol table; if successful avoids actual decoding to Stringprivate final String_findDecodedLong(int len, int q1, int q2) Method for locating names longer than 8 bytes (in UTF-8)private final voidprivate final voidprivate final voidprivate final voidprivate final voidprivate final voidprivate final voidprivate final voidprotected final void_finishNumberToken(int tb) private final voidprotected final voidMethod called to finish parsing of a token so that token contents are retrievableprivate final intprivate final intprivate static int[]_growArrayTo(int[] arr, int minSize) protected final com.fasterxml.jackson.core.JsonTokenMethod that handles initial token type recognition for token that has to be either FIELD_NAME or END_OBJECT.private final voidprivate final com.fasterxml.jackson.core.JsonToken_handleSharedString(int index) protected final booleanprotected final voidprotected final void_loadToHaveAtLeast(int minAvailable) Helper method that will try to load at least specified number bytes in input buffer, possible moving existing data around if necessaryprivate final byteprotected voidprivate final byte[]private void_readBinaryEncoded(OutputStream out, int length, byte[] buffer) private final intprotected voidMethod called to release internal buffers owned by the base reader.protected void_reportInvalidChar(int c) protected void_reportInvalidInitial(int mask) protected void_reportInvalidOther(int mask) protected void_reportInvalidOther(int mask, int ptr) protected void_reportInvalidSharedName(int index) protected void_reportInvalidSharedStringValue(int index) protected voidHelper method for skipping length-prefixed binary data sectionprotected void_skipBytes(int len) protected voidMethod called to skip remainders of an incomplete token, when contents themselves will not be needed any morevoidMethod for forcing full read of current token, even if it might otherwise only be read if data is accessed viagetText()and similar methods.byte[]getBinaryValue(com.fasterxml.jackson.core.Base64Variant b64variant) com.fasterxml.jackson.core.ObjectCodecgetCodec()getText()Method for accessing textual representation of the current event; if no current event (before first call tonextToken(), or after encountering end-of-input), returns null.intchar[]intintgetValueAsString(String defaultValue) protected booleanhandleSignature(boolean consumeFirstByte, boolean throwException) Helper method called when it looks like input might contain the signature; and it is necessary to detect and handle signature to get configuration information it might have.booleanbooleannextFieldName(com.fasterxml.jackson.core.SerializableString str) intnextIntValue(int defaultValue) longnextLongValue(long defaultValue) com.fasterxml.jackson.core.JsonTokenintreadBinaryValue(com.fasterxml.jackson.core.Base64Variant b64variant, OutputStream out) intvoidsetCodec(com.fasterxml.jackson.core.ObjectCodec c) Methods inherited from class com.fasterxml.jackson.dataformat.smile.SmileParserBase
_getSourceReference, _handleEOF, _releaseBuffers, _reportMismatchedEndMarker, _smileBufferRecycler, close, convertNumberToBigDecimal, convertNumberToBigInteger, convertNumberToDouble, convertNumberToFloat, convertNumberToInt, convertNumberToLong, getBigIntegerValue, getCurrentLocation, getCurrentName, getDecimalValue, getDoubleValue, getFloatValue, getFormatFeatures, getIntValue, getLongValue, getNumberType, getNumberValue, getParsingContext, getTokenLocation, isClosed, isNaN, mayContainRawBinary, overrideCurrentName, overrideFormatFeatures, versionMethods inherited from class com.fasterxml.jackson.core.base.ParserMinimalBase
_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, skipChildrenMethods inherited from class com.fasterxml.jackson.core.JsonParser
_codec, _constructError, _reportUnsupportedOperation, canParseAsync, canReadObjectId, canReadTypeId, canUseSchema, configure, currentName, disable, enable, getBinaryValue, getBooleanValue, getByteValue, getCurrentValue, getFeatureMask, getNonBlockingInputFeeder, getObjectId, getSchema, getShortValue, getTypeId, getValueAsBoolean, getValueAsDouble, isEnabled, isEnabled, overrideStdFeatures, readBinaryValue, readValueAs, readValueAs, readValueAsTree, readValuesAs, readValuesAs, releaseBuffered, requiresCustomCodec, setCurrentValue, setFeatureMask, setRequestPayloadOnError, setRequestPayloadOnError, setRequestPayloadOnError, setSchema
-
Field Details
-
_objectCodec
protected com.fasterxml.jackson.core.ObjectCodec _objectCodecCodec used for data binding when (if) requested. -
_inputStream
Input stream that can be used for reading more content, if one in use. May be null, if input comes just as a full buffer, or if the stream has been closed. -
_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 can NOT modify underlying buffer.
-
_typeAsInt
protected int _typeAsIntType byte of the current token (as in) -
_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)
-
-
Constructor Details
-
SmileParser
public SmileParser(com.fasterxml.jackson.core.io.IOContext ctxt, int parserFeatures, int smileFeatures, com.fasterxml.jackson.core.ObjectCodec codec, com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer sym, InputStream in, byte[] inputBuffer, int start, int end, boolean bufferRecyclable)
-
-
Method Details
-
getCodec
public com.fasterxml.jackson.core.ObjectCodec getCodec()- Specified by:
getCodecin classcom.fasterxml.jackson.core.JsonParser
-
setCodec
public void setCodec(com.fasterxml.jackson.core.ObjectCodec c) - Specified by:
setCodecin classcom.fasterxml.jackson.core.JsonParser
-
handleSignature
protected boolean handleSignature(boolean consumeFirstByte, boolean throwException) throws IOException Helper method called when it looks like input might contain the signature; and it is necessary to detect and handle signature to get configuration information it might have.- Returns:
- True if valid signature was found and handled; false if not
- Throws:
IOException
-
releaseBuffered
- Overrides:
releaseBufferedin classcom.fasterxml.jackson.core.JsonParser- Throws:
IOException
-
getInputSource
- Overrides:
getInputSourcein classcom.fasterxml.jackson.core.JsonParser
-
_nextByteGuaranteed
- Throws:
IOException
-
_loadMoreGuaranteed
- Throws:
IOException
-
_loadMore
- Throws:
IOException
-
_loadToHaveAtLeast
Helper method that will try to load at least specified number bytes in input buffer, possible moving existing data around if necessary- Throws:
IOException
-
_closeInput
- Specified by:
_closeInputin classSmileParserBase- Throws:
IOException
-
hasTextCharacters
public boolean hasTextCharacters()- Specified by:
hasTextCharactersin classcom.fasterxml.jackson.core.base.ParserMinimalBase
-
_releaseBuffers2
protected void _releaseBuffers2()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).- Specified by:
_releaseBuffers2in classSmileParserBase
-
nextToken
- Specified by:
nextTokenin classcom.fasterxml.jackson.core.base.ParserMinimalBase- Throws:
IOException
-
_addSeenStringValue
- Throws:
IOException
-
_expandSeenStringValues
-
finishToken
Method for forcing full read of current token, even if it might otherwise only be read if data is accessed viagetText()and similar methods.- Overrides:
finishTokenin classcom.fasterxml.jackson.core.JsonParser- Throws:
IOException
-
nextFieldName
- Overrides:
nextFieldNamein classcom.fasterxml.jackson.core.JsonParser- Throws:
IOException
-
nextFieldName
- Overrides:
nextFieldNamein classcom.fasterxml.jackson.core.JsonParser- Throws:
IOException
-
nextTextValue
- Overrides:
nextTextValuein classcom.fasterxml.jackson.core.JsonParser- Throws:
IOException
-
nextIntValue
- Overrides:
nextIntValuein classcom.fasterxml.jackson.core.JsonParser- Throws:
IOException
-
nextLongValue
- Overrides:
nextLongValuein classcom.fasterxml.jackson.core.JsonParser- Throws:
IOException
-
nextBooleanValue
- Overrides:
nextBooleanValuein classcom.fasterxml.jackson.core.JsonParser- Throws:
IOException
-
getText
Method for accessing textual representation of the current event; if no current event (before first call tonextToken(), or after encountering end-of-input), returns null. Method can be called for any event.- Specified by:
getTextin classcom.fasterxml.jackson.core.base.ParserMinimalBase- Throws:
IOException
-
getTextCharacters
- Specified by:
getTextCharactersin classcom.fasterxml.jackson.core.base.ParserMinimalBase- Throws:
IOException
-
getTextLength
- Specified by:
getTextLengthin classcom.fasterxml.jackson.core.base.ParserMinimalBase- Throws:
IOException
-
getTextOffset
- Specified by:
getTextOffsetin classcom.fasterxml.jackson.core.base.ParserMinimalBase- Throws:
IOException
-
getValueAsString
- Overrides:
getValueAsStringin classcom.fasterxml.jackson.core.base.ParserMinimalBase- Throws:
IOException
-
getValueAsString
- Overrides:
getValueAsStringin classcom.fasterxml.jackson.core.base.ParserMinimalBase- Throws:
IOException
-
getText
- Overrides:
getTextin classcom.fasterxml.jackson.core.JsonParser- Throws:
IOException
-
getBinaryValue
public byte[] getBinaryValue(com.fasterxml.jackson.core.Base64Variant b64variant) throws IOException - Specified by:
getBinaryValuein classcom.fasterxml.jackson.core.base.ParserMinimalBase- Throws:
IOException
-
getEmbeddedObject
- Overrides:
getEmbeddedObjectin classcom.fasterxml.jackson.core.JsonParser- Throws:
IOException
-
readBinaryValue
public int readBinaryValue(com.fasterxml.jackson.core.Base64Variant b64variant, OutputStream out) throws IOException - Overrides:
readBinaryValuein classcom.fasterxml.jackson.core.JsonParser- Throws:
IOException
-
_readBinaryEncoded
- Throws:
IOException
-
_handleFieldName
Method that handles initial token type recognition for token that has to be either FIELD_NAME or END_OBJECT.- Throws:
IOException
-
_expandSeenNames
Method called to try to expand shared name area to fit one more potentially shared String. If area is already at its biggest size, will just clear the area (by setting next-offset to 0) -
_addDecodedToSymbols
-
_decodeShortAsciiName
- Throws:
IOException
-
_decodeShortUnicodeName
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:
IOException
-
_decodeLongUnicodeName
private final String _decodeLongUnicodeName(int[] quads, int byteLen, int quadLen) throws IOException - Throws:
IOException
-
_handleLongFieldName
- Throws:
IOException
-
_findDecodedFromSymbols
Helper method for trying to find specified encoded UTF-8 byte sequence from symbol table; if successful avoids actual decoding to String- Throws:
IOException
-
_findDecodedLong
Method for locating names longer than 8 bytes (in UTF-8)- Throws:
IOException
-
_growArrayTo
private static int[] _growArrayTo(int[] arr, int minSize) -
_parseNumericValue
- Specified by:
_parseNumericValuein classSmileParserBase- Throws:
IOException
-
_finishToken
Method called to finish parsing of a token so that token contents are retrievable- Throws:
IOException
-
_finishNumberToken
- Throws:
IOException
-
_finishInt
- Throws:
IOException
-
_finishIntSlow
- Throws:
IOException
-
_finishLong
- Throws:
IOException
-
_finishLongSlow
- Throws:
IOException
-
_fourBytesToInt
- Throws:
IOException
-
_fourBytesToIntSlow
- Throws:
IOException
-
_finishBigInteger
- Throws:
IOException
-
_finishFloat
- Throws:
IOException
-
_finishDouble
- Throws:
IOException
-
_finishBigDecimal
- Throws:
IOException
-
_readUnsignedVInt
- Throws:
IOException
-
_read7BitBinaryWithLength
- Throws:
IOException
-
_decodeShortAsciiValue
- Throws:
IOException
-
_decodeShortUnicodeValue
- Throws:
IOException
-
_decodeLongAscii
- Throws:
IOException
-
_decodeLongUnicode
- Throws:
IOException
-
_finishRawBinary
- Throws:
IOException
-
_skipIncomplete
Method called to skip remainders of an incomplete token, when contents themselves will not be needed any more- Throws:
IOException
-
_skipBytes
- Throws:
IOException
-
_skip7BitBinary
Helper method for skipping length-prefixed binary data section- Throws:
IOException
-
_decodeUtf8_2
- Throws:
IOException
-
_decodeUtf8_3
- Throws:
IOException
-
_decodeUtf8_3fast
- Throws:
IOException
-
_decodeUtf8_4
- Returns:
- Character value minus 0x10000; this so that caller can readily expand it to actual surrogates
- Throws:
IOException
-
_reportInvalidChar
protected void _reportInvalidChar(int c) throws com.fasterxml.jackson.core.JsonParseException - Throws:
com.fasterxml.jackson.core.JsonParseException
-
_reportInvalidInitial
protected void _reportInvalidInitial(int mask) throws com.fasterxml.jackson.core.JsonParseException - Throws:
com.fasterxml.jackson.core.JsonParseException
-
_reportInvalidOther
protected void _reportInvalidOther(int mask) throws com.fasterxml.jackson.core.JsonParseException - Throws:
com.fasterxml.jackson.core.JsonParseException
-
_reportInvalidOther
protected void _reportInvalidOther(int mask, int ptr) throws com.fasterxml.jackson.core.JsonParseException - Throws:
com.fasterxml.jackson.core.JsonParseException
-
_eofAsNextToken
- Throws:
IOException
-