java.lang.Object
tools.jackson.core.JsonParser
tools.jackson.core.base.ParserMinimalBase
tools.jackson.core.base.ParserBase
tools.jackson.dataformat.yaml.YAMLParser
All Implemented Interfaces:
Closeable, AutoCloseable, tools.jackson.core.Versioned

public class YAMLParser extends tools.jackson.core.base.ParserBase
JsonParser implementation used to expose YAML documents in form that allows other Jackson functionality to process YAML content, such as binding POJOs to and from it, and building tree representations.
  • Nested Class Summary

    Nested classes/interfaces inherited from class tools.jackson.core.JsonParser

    tools.jackson.core.JsonParser.NumberType, tools.jackson.core.JsonParser.NumberTypeFP
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final boolean
     
    protected String
    For some tokens (specifically, numbers), we'll have cleaned up version, mostly free of underscores
    protected Optional<org.snakeyaml.engine.v2.common.Anchor>
    Anchor for the value that parser currently points to: in case of structured types, value whose first token current token is.
    protected boolean
    Flag that is set when current token was derived from an Alias (reference to another value's anchor)
    protected String
    Let's also have a local copy of the current property name
    protected final int
     
    protected org.snakeyaml.engine.v2.events.Event
    Keep track of the last event read, to get access to Location info
    protected org.snakeyaml.engine.v2.events.Event
    To keep track of tags ("type ids"), need to either get tags for all events, or, keep tag of relevant event that might have it: this is different from _lastEvent in some cases.
    protected final Reader
    Need to keep track of underlying Reader to be able to auto-close it (if required to)
    protected tools.jackson.core.util.SimpleStreamReadContext
    Information about parser context, context in which the next token is to be parsed (root, array, object).
    protected String
    We need to keep track of text values.
    protected final org.snakeyaml.engine.v2.parser.ParserImpl
     
    protected final org.snakeyaml.engine.v2.resolver.ScalarResolver
     

    Fields 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, _tokenInputTotal

    Fields 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_DEFAULTS

    Fields inherited from class tools.jackson.core.JsonParser

    DEFAULT_READ_CAPABILITIES
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    YAMLParser(tools.jackson.core.ObjectReadContext readCtxt, tools.jackson.core.io.IOContext ioCtxt, tools.jackson.core.util.BufferRecycler br, int streamReadFeatures, int formatFeatures, Reader reader, org.snakeyaml.engine.v2.parser.ParserImpl yamlParser)
     
     
    YAMLParser(tools.jackson.core.ObjectReadContext readCtxt, tools.jackson.core.io.IOContext ioCtxt, tools.jackson.core.util.BufferRecycler br, int streamReadFeatures, int formatFeatures, org.snakeyaml.engine.v2.api.LoadSettings loadSettings, Reader reader)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
     
    protected tools.jackson.core.JsonToken
    _decodeNumberIntBinary(String value, int i, int origLen, boolean negative)
     
    protected tools.jackson.core.JsonToken
    _decodeNumberIntHex(String value, int i, int origLen, boolean negative)
     
    protected tools.jackson.core.JsonToken
    _decodeNumberIntOctal(String value, int i, int origLen, boolean negative)
     
    protected tools.jackson.core.JsonToken
    _decodeNumberScalar(String value, int len)
     
    protected tools.jackson.core.JsonToken
    _decodeScalar(org.snakeyaml.engine.v2.events.ScalarEvent scalar)
     
    protected tools.jackson.core.TokenStreamLocation
    _locationFor(Optional<org.snakeyaml.engine.v2.exceptions.Mark> option)
     
    protected Boolean
    _matchYAMLBoolean(String value, int len)
     
    protected int
     
    protected void
    _parseNumericValue(int expType)
     
    protected void
    _reportMismatchedEndMarker(int actCh, char expCh)
     
    void
     
    boolean
     
    boolean
     
    tools.jackson.core.TokenStreamLocation
     
     
    tools.jackson.core.TokenStreamLocation
     
     
     
     
     
     
    int
    getString(Writer writer)
     
    char[]
     
    int
     
    int
     
     
    boolean
     
    boolean
    Method that can be used to check whether current token was created from YAML Alias token (reference to an anchor).
    boolean
    Method for checking whether specified YAMLReadFeature is enabled.
    protected org.snakeyaml.engine.v2.events.Event
     
    tools.jackson.core.JsonToken
     
    int
    readBinaryValue(tools.jackson.core.Base64Variant b64variant, OutputStream out)
     
    tools.jackson.core.util.JacksonFeatureSet<tools.jackson.core.StreamReadCapability>
     
    tools.jackson.core.TokenStreamContext
     
     
    tools.jackson.core.Version
     

    Methods inherited from class tools.jackson.core.base.ParserBase

    _contentReference, _contentReferenceRedacted, _convertBigDecimalToBigInteger, _decodeBase64Escape, _decodeBase64Escape, _decodeEscaped, _eofAsNextChar, _getBigDecimal, _getBigInteger, _getByteArrayBuilder, _getNumberDouble, _getNumberFloat, _growNameDecodeBuffer, _handleBase64MissingPadding, _handleEOF, _releaseBuffers, _reportInvalidBase64Char, _reportInvalidBase64Char, close, convertNumberToBigDecimal, convertNumberToBigInteger, convertNumberToDouble, convertNumberToFloat, convertNumberToInt, convertNumberToLong, getBigIntegerValue, getBinaryValue, getDecimalValue, getDoubleValue, getFloatValue, getIntValue, getLongValue, getNumberType, getNumberValue, getNumberValueExact, getTokenCharacterOffset, getTokenColumnNr, getTokenLineNr, growArrayBy, isNaN, reset, resetAsNaN, resetFloat, resetInt

    Methods inherited from class tools.jackson.core.base.ParserMinimalBase

    _constructInputCoercion, _constructNotNumericType, _currentLocationMinusOne, _decodeBase64, _getCharDesc, _hasTextualNull, _longIntegerDesc, _longNumberDesc, _nullSafeUpdateToken, _reportBadInputStream, _reportBadReader, _reportError, _reportError, _reportError, _reportError, _reportInvalidEOF, _reportInvalidEOF, _reportInvalidEOFInValue, _reportInvalidNumber, _reportInvalidSpace, _reportInvalidUTF8Surrogate, _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, getValueAsString, getValueAsString, hasCurrentToken, hasToken, hasTokenId, isClosed, isEnabled, isExpectedNumberIntToken, isExpectedStartArrayToken, isExpectedStartObjectToken, nextName, nextName, nextNameMatch, nextValue, objectReadContext, readValueAs, readValueAs, readValueAs, readValueAsTree, skipChildren, streamReadConstraints, streamReadFeatures

    Methods inherited from class tools.jackson.core.JsonParser

    _constructReadException, _constructReadException, _constructReadException, _constructReadException, _constructReadException, _constructReadException, _reportUnsupportedOperation, canParseAsync, getBinaryValue, getSchema, getText, getTextCharacters, getTextLength, getTextOffset, getValueAsBoolean, getValueAsDouble, nextBooleanValue, nextIntValue, nextLongValue, nextStringValue, nonBlockingInputFeeder, readBinaryValue, releaseBuffered, releaseBuffered

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • _formatFeatures

      protected final int _formatFeatures
    • _cfgEmptyStringsToNull

      protected final boolean _cfgEmptyStringsToNull
    • _reader

      protected final Reader _reader
      Need to keep track of underlying Reader to be able to auto-close it (if required to)
    • _yamlParser

      protected final org.snakeyaml.engine.v2.parser.ParserImpl _yamlParser
    • _yamlResolver

      protected final org.snakeyaml.engine.v2.resolver.ScalarResolver _yamlResolver
    • _streamReadContext

      protected tools.jackson.core.util.SimpleStreamReadContext _streamReadContext
      Information about parser context, context in which the next token is to be parsed (root, array, object).
    • _lastEvent

      protected org.snakeyaml.engine.v2.events.Event _lastEvent
      Keep track of the last event read, to get access to Location info
    • _lastTagEvent

      protected org.snakeyaml.engine.v2.events.Event _lastTagEvent
      To keep track of tags ("type ids"), need to either get tags for all events, or, keep tag of relevant event that might have it: this is different from _lastEvent in some cases.
    • _textValue

      protected String _textValue
      We need to keep track of text values.
    • _cleanedTextValue

      protected String _cleanedTextValue
      For some tokens (specifically, numbers), we'll have cleaned up version, mostly free of underscores
    • _currentName

      protected String _currentName
      Let's also have a local copy of the current property name
    • _currentIsAlias

      protected boolean _currentIsAlias
      Flag that is set when current token was derived from an Alias (reference to another value's anchor)
    • _currentAnchor

      protected Optional<org.snakeyaml.engine.v2.common.Anchor> _currentAnchor
      Anchor for the value that parser currently points to: in case of structured types, value whose first token current token is.
  • Constructor Details

    • YAMLParser

      public YAMLParser(tools.jackson.core.ObjectReadContext readCtxt, tools.jackson.core.io.IOContext ioCtxt, tools.jackson.core.util.BufferRecycler br, int streamReadFeatures, int formatFeatures, org.snakeyaml.engine.v2.api.LoadSettings loadSettings, Reader reader)
    • YAMLParser

      protected YAMLParser(tools.jackson.core.ObjectReadContext readCtxt, tools.jackson.core.io.IOContext ioCtxt, tools.jackson.core.util.BufferRecycler br, int streamReadFeatures, int formatFeatures, Reader reader, org.snakeyaml.engine.v2.parser.ParserImpl yamlParser)
  • Method Details

    • version

      public tools.jackson.core.Version version()
      Specified by:
      version in interface tools.jackson.core.Versioned
      Specified by:
      version in class tools.jackson.core.JsonParser
    • isCurrentAlias

      public boolean isCurrentAlias()
      Method that can be used to check whether current token was created from YAML Alias token (reference to an anchor).
    • canReadObjectId

      public boolean canReadObjectId()
      Overrides:
      canReadObjectId in class tools.jackson.core.JsonParser
    • canReadTypeId

      public boolean canReadTypeId()
      Overrides:
      canReadTypeId in class tools.jackson.core.JsonParser
    • streamReadCapabilities

      public tools.jackson.core.util.JacksonFeatureSet<tools.jackson.core.StreamReadCapability> streamReadCapabilities()
      Overrides:
      streamReadCapabilities in class tools.jackson.core.base.ParserMinimalBase
    • streamReadInputSource

      public Reader streamReadInputSource()
      Specified by:
      streamReadInputSource in class tools.jackson.core.JsonParser
    • _closeInput

      protected void _closeInput() throws IOException
      Specified by:
      _closeInput in class tools.jackson.core.base.ParserMinimalBase
      Throws:
      IOException
    • streamReadContext

      public tools.jackson.core.TokenStreamContext streamReadContext()
      Specified by:
      streamReadContext in class tools.jackson.core.JsonParser
    • assignCurrentValue

      public void assignCurrentValue(Object v)
      Overrides:
      assignCurrentValue in class tools.jackson.core.base.ParserBase
    • currentValue

      public Object currentValue()
      Overrides:
      currentValue in class tools.jackson.core.base.ParserBase
    • isEnabled

      public boolean isEnabled(YAMLReadFeature f)
      Method for checking whether specified YAMLReadFeature is enabled.
    • currentTokenLocation

      public tools.jackson.core.TokenStreamLocation currentTokenLocation()
      Specified by:
      currentTokenLocation in class tools.jackson.core.JsonParser
    • currentLocation

      public tools.jackson.core.TokenStreamLocation currentLocation()
      Specified by:
      currentLocation in class tools.jackson.core.JsonParser
    • _locationFor

      protected tools.jackson.core.TokenStreamLocation _locationFor(Optional<org.snakeyaml.engine.v2.exceptions.Mark> option)
    • nextToken

      public tools.jackson.core.JsonToken nextToken() throws tools.jackson.core.JacksonException
      Specified by:
      nextToken in class tools.jackson.core.JsonParser
      Throws:
      tools.jackson.core.JacksonException
    • nextEvent

      protected org.snakeyaml.engine.v2.events.Event nextEvent()
    • _decodeScalar

      protected tools.jackson.core.JsonToken _decodeScalar(org.snakeyaml.engine.v2.events.ScalarEvent scalar) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _matchYAMLBoolean

      protected Boolean _matchYAMLBoolean(String value, int len)
    • _decodeNumberScalar

      protected tools.jackson.core.JsonToken _decodeNumberScalar(String value, int len) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _decodeNumberIntBinary

      protected tools.jackson.core.JsonToken _decodeNumberIntBinary(String value, int i, int origLen, boolean negative) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _decodeNumberIntOctal

      protected tools.jackson.core.JsonToken _decodeNumberIntOctal(String value, int i, int origLen, boolean negative) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _decodeNumberIntHex

      protected tools.jackson.core.JsonToken _decodeNumberIntHex(String value, int i, int origLen, boolean negative) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • hasStringCharacters

      public boolean hasStringCharacters()
      Overrides:
      hasStringCharacters in class tools.jackson.core.base.ParserBase
    • getString

      public String getString() throws tools.jackson.core.JacksonException
      Specified by:
      getString in class tools.jackson.core.JsonParser
      Throws:
      tools.jackson.core.JacksonException
    • currentName

      public String currentName() throws tools.jackson.core.JacksonException
      Specified by:
      currentName in class tools.jackson.core.JsonParser
      Throws:
      tools.jackson.core.JacksonException
    • getStringCharacters

      public char[] getStringCharacters() throws tools.jackson.core.JacksonException
      Specified by:
      getStringCharacters in class tools.jackson.core.JsonParser
      Throws:
      tools.jackson.core.JacksonException
    • getStringLength

      public int getStringLength() throws tools.jackson.core.JacksonException
      Specified by:
      getStringLength in class tools.jackson.core.JsonParser
      Throws:
      tools.jackson.core.JacksonException
    • getStringOffset

      public int getStringOffset() throws tools.jackson.core.JacksonException
      Specified by:
      getStringOffset in class tools.jackson.core.JsonParser
      Throws:
      tools.jackson.core.JacksonException
    • getString

      public int getString(Writer writer) throws tools.jackson.core.JacksonException
      Overrides:
      getString in class tools.jackson.core.base.ParserMinimalBase
      Throws:
      tools.jackson.core.JacksonException
    • getEmbeddedObject

      public Object getEmbeddedObject() throws tools.jackson.core.JacksonException
      Overrides:
      getEmbeddedObject in class tools.jackson.core.base.ParserMinimalBase
      Throws:
      tools.jackson.core.JacksonException
    • readBinaryValue

      public int readBinaryValue(tools.jackson.core.Base64Variant b64variant, OutputStream out) throws tools.jackson.core.JacksonException
      Overrides:
      readBinaryValue in class tools.jackson.core.JsonParser
      Throws:
      tools.jackson.core.JacksonException
    • getNumberValueDeferred

      public Object getNumberValueDeferred() throws tools.jackson.core.JacksonException
      Overrides:
      getNumberValueDeferred in class tools.jackson.core.base.ParserBase
      Throws:
      tools.jackson.core.JacksonException
    • _parseNumericValue

      protected void _parseNumericValue(int expType) throws tools.jackson.core.JacksonException
      Specified by:
      _parseNumericValue in class tools.jackson.core.base.ParserBase
      Throws:
      tools.jackson.core.JacksonException
    • _parseIntValue

      protected int _parseIntValue() throws tools.jackson.core.JacksonException
      Specified by:
      _parseIntValue in class tools.jackson.core.base.ParserBase
      Throws:
      tools.jackson.core.JacksonException
    • getObjectId

      public String getObjectId() throws tools.jackson.core.JacksonException
      Overrides:
      getObjectId in class tools.jackson.core.JsonParser
      Throws:
      tools.jackson.core.JacksonException
    • getTypeId

      public String getTypeId() throws tools.jackson.core.JacksonException
      Overrides:
      getTypeId in class tools.jackson.core.JsonParser
      Throws:
      tools.jackson.core.JacksonException
    • _reportMismatchedEndMarker

      protected void _reportMismatchedEndMarker(int actCh, char expCh) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException