Package akka.stream.impl.io
Class ByteStringParser.ParsingLogic
- java.lang.Object
-
- akka.stream.stage.GraphStageLogic
-
- akka.stream.impl.io.ByteStringParser.ParsingLogic
-
- All Implemented Interfaces:
InHandler
,OutHandler
- Direct Known Subclasses:
DeflateDecompressorBase.DecompressorParsingLogic
- Enclosing class:
- ByteStringParser<T>
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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class akka.stream.stage.GraphStageLogic
GraphStageLogic.ConditionalTerminateInput, GraphStageLogic.ConditionalTerminateOutput, GraphStageLogic.EagerTerminateInput$, GraphStageLogic.EagerTerminateOutput$, GraphStageLogic.IgnoreTerminateInput$, GraphStageLogic.IgnoreTerminateOutput$, GraphStageLogic.StageActor, GraphStageLogic.StageActorRef$, GraphStageLogic.StageActorRefNotInitializedException, GraphStageLogic.StageActorRefNotInitializedException$, GraphStageLogic.SubSinkInlet<T>, GraphStageLogic.SubSourceOutlet<T>, GraphStageLogic.TotallyIgnorantInput$
-
-
Constructor Summary
Constructors Constructor Description ParsingLogic()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onPull()
Called when the output port has received a pull, and therefore ready to emit an element, i.e.void
onPush()
Called when the input port has a new element available.void
onUpstreamFinish()
Called when the input port is finished.protected int
recursionLimit()
protected void
startWith(ByteStringParser.ParseStep<T> step)
-
Methods inherited from class akka.stream.stage.GraphStageLogic
abortEmitting, abortReading, afterPostStop, attributes, attributes_$eq, beforePreStart, cancel, cancelStage, complete, completeStage, conditionalTerminateInput, conditionalTerminateOutput, createAsyncCallback, eagerTerminateInput, eagerTerminateOutput, emit, emit, emit, emitMultiple, emitMultiple, emitMultiple, emitMultiple, emitMultiple, emitMultiple, fail, failStage, getAsyncCallback, getEagerStageActor, getHandler, getHandler, getStageActor, grab, handlers, hasBeenPulled, ignoreTerminateInput, ignoreTerminateOutput, inCount, inHandler, interpreter, interpreter_$eq, isAvailable, isAvailable, isClosed, isClosed, materializer, NoPromise, onFeedbackDispatched, originalStage, originalStage_$eq, outCount, outHandler, passAlong, passAlong$default$3, passAlong$default$4, passAlong$default$5, portToConn, postStop, preStart, pull, push, read, read, readN, readN, setHandler, setHandler, setHandlers, setKeepGoing, stageActor, stageActorName, stageId, stageId_$eq, subFusingMaterializer, totallyIgnorantInput, tryPull
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface akka.stream.stage.InHandler
onUpstreamFailure
-
Methods inherited from interface akka.stream.stage.OutHandler
onDownstreamFinish
-
-
-
-
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 interfaceOutHandler
-
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.
-
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 interfaceInHandler
-
recursionLimit
protected int recursionLimit()
-
startWith
protected final void startWith(ByteStringParser.ParseStep<T> step)
-
-