Class BaseChunkResponseParser<H extends ChunkHeader,​ROW extends ChunkRow,​T extends ChunkTrailer>

    • Constructor Detail

      • BaseChunkResponseParser

        public BaseChunkResponseParser()
    • Method Detail

      • parserBuilder

        protected abstract JsonStreamParser.Builder parserBuilder()
        Subclass implements this to return the "meat" of the decoding, the chunk parser.
      • responseHeader

        protected responseHeader()
      • markHeaderComplete

        protected void markHeaderComplete()
      • isHeaderComplete

        protected boolean isHeaderComplete()
        Only for use by subclasses. External collaborators should call ChunkResponseParser.header(boolean) to see if the header is ready.
      • doCleanup

        protected abstract void doCleanup()
        Give subclasses a chance to reset their state.
      • feed

        public void feed​( input)
        Description copied from interface: ChunkResponseParser
        Parses the given JSON document fragment. The parser takes ownership of the buffer and is responsible for releasing it.
        Specified by:
        feed in interface ChunkResponseParser<H extends ChunkHeader,​ROW extends ChunkRow,​T extends ChunkTrailer>
      • initialize

        public void initialize​( channelConfig)
        Initializes the parser to a fresh state.
        Specified by:
        initialize in interface ChunkResponseParser<H extends ChunkHeader,​ROW extends ChunkRow,​T extends ChunkTrailer>
        channelConfig - the channel config used for backpressure auto-read.
      • signalComplete

        protected abstract void signalComplete()
        Called when the JSON stream has been parsed completely and successfully.
      • emitRow

        protected void emitRow​(ROW row)
        Emits a single row into the rows flux.

        Note that this method also handles the backpressure stalling side. If we find that someone is subscribed to this flux but has not requested any further rows, the channel auto-read is going to be paused until further rows are requested or the subscriber unsubscribes.

        row - the row to emit.
      • failRows

        protected void failRows​(Throwable t)
        Fails the row flux with the given message.
        t - the throwable with which to fail the rows.
      • completeRows

        protected void completeRows()
        Completes the row flux.
      • completeTrailer

        protected void completeTrailer​(T trailer)
        Called from the child implementation to complete the trailing bits.
        trailer - the trailer value to be fed into the mono.