Class ByteStringParser.ParsingLogic

  • All Implemented Interfaces:
    InHandler, OutHandler
    Direct Known Subclasses:
    Enclosing class:

    public class ByteStringParser.ParsingLogic
    extends GraphStageLogic
    implements InHandler, OutHandler
    doParse() is the main driver for the parser. It can be called from onPush, onPull and onUpstreamFinish. The general logic is that invocation of this method either results in an emitted parsed element, or an indication that there is more data needed.

    On completion there are various cases: - buffer is empty: parser accepts completion or fails. - buffer is non-empty, we wait for a pull. This might result in a few more onPull-push cycles, served from the buffer. This can lead to two conditions: - drained, empty buffer. This is either accepted completion (acceptUpstreamFinish) or a truncation. - parser demands more data than in buffer. This is always a truncation.

    If the return value is true the method must be called another time to continue processing.

    • Constructor Detail

      • ParsingLogic

        public ParsingLogic()
    • Method Detail

      • onPull

        public void onPull()
        Description copied from interface: OutHandler
        Called when the output port has received a pull, and therefore ready to emit an element, i.e. {@link GraphStageLogic.push()} is now allowed to be called on this port.
        Specified by:
        onPull in interface OutHandler
      • onPush

        public void onPush()
        Description copied from interface: InHandler
        Called when the input port has a new element available. The actual element can be retrieved via the {@link GraphStageLogic.grab()} method.
        Specified by:
        onPush in interface InHandler
      • onUpstreamFinish

        public void onUpstreamFinish()
        Description copied from interface: InHandler
        Called when the input port is finished. After this callback no other callbacks will be called for this port.
        Specified by:
        onUpstreamFinish in interface InHandler
      • recursionLimit

        protected int recursionLimit()