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, com.fasterxml.jackson.core.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 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 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, _streamReadConstraints, _streamReadContext, _symbols, _symbolsCanonical, _textBuffer, _tokenOffsetForTotal, DEFAULT_NAME_BUFFER_LENGTH, DEFAULT_STRING_VALUE_BUFFER_LENGTH, LONGEST_NON_CHUNKED_BINARY, NO_STRINGS, SMILE_READ_CAPABILITIESFields 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, DEFAULT_READ_CAPABILITIES -
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 TypeMethodDescriptionprotected voidprotected final String_decodeShortAsciiValue(int len) protected final String_decodeShortUnicodeValue(int byteLen) protected byte[]_finishBinary7BitLong(int expLen) protected byte[]_finishBinaryRawLong(int expLen) protected final void_finishNumberToken(int tb) protected final voidMethod called to finish parsing of a token so that token contents are retrievableprotected final com.fasterxml.jackson.core.JsonTokenMethod that handles initial token type recognition for token that has to be either FIELD_NAME or END_OBJECT.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 necessary.protected voidprotected final intprotected final intprotected voidMethod called to release internal buffers owned by the base reader.protected void_reportIncompleteBinaryRead7Bit(int expLen, int actLen) protected void_reportIncompleteBinaryReadRaw(int expLen, int actLen) 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 final void_reportInvalidUnsignedVInt(int firstCh, int lastCh) protected String_reportTruncatedUTF8InName(int strLenBytes, int truncatedCharOffset, int firstUTFByteValue, int bytesExpected) protected String_reportTruncatedUTF8InString(int strLenBytes, int truncatedCharOffset, int firstUTFByteValue, int bytesExpected) 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 moreprotected final int_tryToLoadToHaveAtLeast(int minAvailable) Helper method that will try to load at least specified number bytes in input buffer, possible moving existing data around if necessary.voidMethod 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 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, streamReadConstraints, versionMethods inherited from class com.fasterxml.jackson.core.base.ParserMinimalBase
_ascii, _asciiBytes, _constructError, _currentLocationMinusOne, _decodeBase64, _getCharDesc, _hasTextualNull, _longIntegerDesc, _longNumberDesc, _reportError, _reportError, _reportError, _reportInputCoercion, _reportInvalidEOF, _reportInvalidEOF, _reportInvalidEOFInValue, _reportMissingRootWS, _reportUnexpectedChar, _reportUnexpectedNumberChar, _throwInternal, _throwInternalReturnAny, _throwInvalidSpace, _wrapError, clearCurrentToken, currentToken, currentTokenId, getCurrentToken, getCurrentTokenId, getLastClearedToken, getValueAsBoolean, getValueAsDouble, getValueAsInt, getValueAsInt, getValueAsLong, getValueAsLong, hasCurrentToken, hasToken, hasTokenId, isExpectedNumberIntToken, isExpectedStartArrayToken, isExpectedStartObjectToken, nextValue, reportInvalidNumber, reportOverflowInt, reportOverflowInt, reportOverflowInt, reportOverflowLong, reportOverflowLong, reportOverflowLong, reportUnexpectedNumberChar, skipChildrenMethods inherited from class com.fasterxml.jackson.core.JsonParser
_codec, _constructError, _constructReadException, _constructReadException, _constructReadException, _constructReadException, _constructReadException, _constructReadException, _reportUnsupportedOperation, assignCurrentValue, canParseAsync, canReadObjectId, canReadTypeId, canUseSchema, configure, currentValue, disable, enable, getBinaryValue, getBooleanValue, getByteValue, getCurrentValue, getFeatureMask, getNonBlockingInputFeeder, getNumberValueDeferred, 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
-
_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. Exception throws if not enough content can be read.- Parameters:
minAvailable- Minimum number of bytes we absolutely need- Throws:
IOException- if read failed, either due to I/O issue or because not enough content could be read before end-of-input.
-
_tryToLoadToHaveAtLeast
Helper method that will try to load at least specified number bytes in input buffer, possible moving existing data around if necessary.- Returns:
- Number of bytes that were missing, if any;
0for successful read - Throws:
IOException- Since:
- 2.12.3
-
_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
-
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
-
_handleFieldName
Method that handles initial token type recognition for token that has to be either FIELD_NAME or END_OBJECT.- Throws:
IOException
-
_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
-
_readUnsignedVInt
- Throws:
IOException
-
_readUnsignedVIntSlow
- Throws:
IOException
-
_reportInvalidUnsignedVInt
- Throws:
IOException
-
_decodeShortAsciiValue
- Throws:
IOException
-
_decodeShortUnicodeValue
- Throws:
IOException
-
_finishBinaryRawLong
- Throws:
IOException
-
_finishBinary7BitLong
- 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
-
_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
-
_reportIncompleteBinaryReadRaw
- Throws:
IOException
-
_reportIncompleteBinaryRead7Bit
- Throws:
IOException
-
_reportTruncatedUTF8InString
protected String _reportTruncatedUTF8InString(int strLenBytes, int truncatedCharOffset, int firstUTFByteValue, int bytesExpected) throws IOException - Throws:
IOException
-
_reportTruncatedUTF8InName
protected String _reportTruncatedUTF8InName(int strLenBytes, int truncatedCharOffset, int firstUTFByteValue, int bytesExpected) throws IOException - Throws:
IOException
-