Class AccumulatingJsonStreamParser

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class AccumulatingJsonStreamParser
    extends AbstractJsonStreamParser
    implements java.lang.AutoCloseable
    A json reader that receives chunks of json data and accumulates them in a non-blocking-parser until a chunk of json data defined by jsonPath is ready to be processed. Calls the callback with the chunk of JSON data.
    • Field Detail

      • parser

        protected final org.jsfr.json.NonBlockingParser parser
        Reference to the parser that is used here
      • charset

        protected final java.nio.charset.Charset charset
    • Constructor Detail

      • AccumulatingJsonStreamParser

        protected AccumulatingJsonStreamParser​(AccumulatingJsonStreamParser.Conf<?> builder)
        Protected constructor
        Parameters:
        builder - The builder for this class.
    • Method Detail

      • feed

        public void feed​(java.lang.String data)
        Add data to the parser.
        Parameters:
        data - Incoming data for the parser.
      • feed

        public void feed​(byte[] data)
        Add data to the parser.
        Parameters:
        data - Incoming data for the parser as byte[]. Ignores the charset.
      • close

        public void close()
                   throws java.lang.Exception
        Tell the parser that all data for it has ended.
        Specified by:
        close in interface java.lang.AutoCloseable
        Throws:
        java.lang.Exception