com.fasterxml.jackson.core.util

Class JsonParserSequence

    • Field Detail

      • _parsers

        protected final JsonParser[] _parsers
        Parsers other than the first one (which is initially assigned as delegate)
      • _nextParser

        protected int _nextParser
        Index of the next parser in _parsers.
    • Constructor Detail

      • JsonParserSequence

        protected JsonParserSequence(JsonParser[] parsers)
    • Method Detail

      • createFlattened

        public static JsonParserSequence createFlattened(JsonParser first,
                                         JsonParser second)
        Method that will construct a parser (possibly a sequence) that contains all given sub-parsers. All parsers given are checked to see if they are sequences: and if so, they will be "flattened", that is, contained parsers are directly added in a new sequence instead of adding sequences within sequences. This is done to minimize delegation depth, ideally only having just a single level of delegation.
      • addFlattenedActiveParsers

        protected void addFlattenedActiveParsers(List<JsonParser> result)
      • close

        public void close()
                   throws IOException
        Description copied from class: JsonParser
        Closes the parser so that no further iteration or data access can be made; will also close the underlying input source if parser either owns the input source, or feature JsonParser.Feature.AUTO_CLOSE_SOURCE is enabled. Whether parser owns the input source depends on factory method that was used to construct instance (so check JsonFactory for details, but the general idea is that if caller passes in closable resource (such as InputStream or Reader) parser does NOT own the source; but if it passes a reference (such as File or URL and creates stream or reader it does own them.
        Specified by:
        close in interface Closeable
        Specified by:
        close in interface AutoCloseable
        Overrides:
        close in class JsonParserDelegate
        Throws:
        IOException
      • containedParsersCount

        public int containedParsersCount()
        Method that is most useful for debugging or testing; returns actual number of underlying parsers sequence was constructed with (nor just ones remaining active)
      • switchToNext

        protected boolean switchToNext()
        Method that will switch active parser from the current one to next parser in sequence, if there is another parser left, making this the new delegate. Old delegate is returned if switch succeeds.
        Returns:
        True if switch succeeded; false otherwise

Copyright © 2012 FasterXML. All Rights Reserved.