Package akka.stream.impl.io
Class ByteStringParser<T>
- java.lang.Object
-
- akka.stream.stage.GraphStageWithMaterializedValue<S,NotUsed>
-
- akka.stream.stage.GraphStage<FlowShape<ByteString,T>>
-
- akka.stream.impl.io.ByteStringParser<T>
-
- All Implemented Interfaces:
Graph<FlowShape<ByteString,T>,NotUsed>
- Direct Known Subclasses:
DeflateDecompressorBase
,TcpFraming
public abstract class ByteStringParser<T> extends GraphStage<FlowShape<ByteString,T>>
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 Modifier and Type Class Description static class
ByteStringParser.ByteReader
static class
ByteStringParser.FinishedParser$
static class
ByteStringParser.ParseResult<T>
param: result - parser can return some element for downstream or return None if no element was generated in this step and parsing should immediately continue with the next step.static class
ByteStringParser.ParseResult$
static interface
ByteStringParser.ParseStep<T>
static class
ByteStringParser.ParsingException
class
ByteStringParser.ParsingLogic
doParse() is the main driver for the parser.
-
Constructor Summary
Constructors Constructor Description ByteStringParser()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static int
CompactionThreshold()
Attributes
initialAttributes()
static java.lang.Exception
NeedMoreData()
FlowShape<ByteString,T>
shape()
The shape of a graph is all that is externally visible: its inlets and outlets.-
Methods inherited from class akka.stream.stage.GraphStage
createLogic, createLogicAndMaterializedValue
-
Methods inherited from class akka.stream.stage.GraphStageWithMaterializedValue
createLogicAndMaterializedValue, traversalBuilder, withAttributes
-
-
-
-
Method Detail
-
CompactionThreshold
public static int CompactionThreshold()
-
NeedMoreData
public static java.lang.Exception NeedMoreData()
-
initialAttributes
public Attributes initialAttributes()
- Overrides:
initialAttributes
in classGraphStageWithMaterializedValue<FlowShape<ByteString,T>,NotUsed>
-
shape
public final FlowShape<ByteString,T> shape()
Description copied from interface:Graph
The shape of a graph is all that is externally visible: its inlets and outlets.- Returns:
- (undocumented)
-
-