Package akka.http.impl.util
Class StreamUtils
- java.lang.Object
-
- akka.http.impl.util.StreamUtils
-
public class StreamUtils extends java.lang.Object
INTERNAL API
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StreamUtils.CaptureMaterializationAndTerminationOp$
static class
StreamUtils.CaptureTerminationOp$
static class
StreamUtils.DelayCancellationStage<T>
INTERNAL APIstatic interface
StreamUtils.EntityStreamOp<M>
static interface
StreamUtils.OneTimeValve
Similar to Source.maybe but doesn't rely on materialization.static class
StreamUtils.OneTimeValve$
static interface
StreamUtils.ScheduleSupport
static class
StreamUtils.StreamControl
static class
StreamUtils.StreamControl$
-
Constructor Summary
Constructors Constructor Description StreamUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static akka.stream.stage.GraphStage<akka.stream.FlowShape<akka.util.ByteString,akka.util.ByteString>>
byteStringTransformer(scala.Function1<akka.util.ByteString,akka.util.ByteString> f, scala.Function0<akka.util.ByteString> finish)
Creates a transformer that will callf
for each incoming ByteString and output its result.static void
cancelSource(akka.stream.scaladsl.Source<?,?> source, akka.stream.Materializer materializer)
Tries to guess whether a source needs to cancelled and how.static <T,Mat>
scala.Tuple4<akka.stream.scaladsl.Source<T,Mat>,scala.concurrent.Future<scala.runtime.BoxedUnit>,scala.concurrent.Future<scala.runtime.BoxedUnit>,akka.stream.KillSwitch>captureMaterializationTerminationAndKillSwitch(akka.stream.scaladsl.Source<T,Mat> source)
static <T,Mat>
scala.Tuple2<akka.stream.scaladsl.Source<T,Mat>,scala.concurrent.Future<scala.runtime.BoxedUnit>>captureTermination(akka.stream.scaladsl.Source<T,Mat> source)
static <T> akka.stream.scaladsl.Flow<T,T,akka.NotUsed>
delayCancellation(scala.concurrent.duration.Duration cancelAfter)
INTERNAL APIstatic <T> akka.stream.scaladsl.Flow<T,T,akka.NotUsed>
encodeErrorAndComplete(scala.Function1<java.lang.Throwable,T> f)
static akka.stream.stage.GraphStage<akka.stream.FlowShape<akka.util.ByteString,akka.util.ByteString>>
limitByteChunksStage(int maxBytesPerChunk)
static akka.stream.Materializer
OnlyRunInGraphInterpreterContext()
Dummy name to signify that the caller asserts that cancelSource is only run from within a GraphInterpreter contextstatic akka.stream.scaladsl.Flow<akka.util.ByteString,akka.util.ByteString,akka.NotUsed>
sliceBytesTransformer(long start, long length)
static <T,U>
akka.stream.scaladsl.Flow<T,U,akka.NotUsed>statefulAttrsMap(scala.Function1<akka.stream.Attributes,scala.Function1<T,U>> functionConstructor)
Lifts the streams attributes into an element and passes them to the function for each passed through element.static <T extends HttpEntity,M>
scala.Tuple2<T,M>transformEntityStream(T entity, StreamUtils.EntityStreamOp<M> streamOp)
-
-
-
Method Detail
-
byteStringTransformer
public static akka.stream.stage.GraphStage<akka.stream.FlowShape<akka.util.ByteString,akka.util.ByteString>> byteStringTransformer(scala.Function1<akka.util.ByteString,akka.util.ByteString> f, scala.Function0<akka.util.ByteString> finish)
Creates a transformer that will callf
for each incoming ByteString and output its result. After the complete input has been read it will callfinish
once to determine the final ByteString to post to the output. Empty ByteStrings are discarded.- Parameters:
f
- (undocumented)finish
- (undocumented)- Returns:
- (undocumented)
-
captureTermination
public static <T,Mat> scala.Tuple2<akka.stream.scaladsl.Source<T,Mat>,scala.concurrent.Future<scala.runtime.BoxedUnit>> captureTermination(akka.stream.scaladsl.Source<T,Mat> source)
-
captureMaterializationTerminationAndKillSwitch
public static <T,Mat> scala.Tuple4<akka.stream.scaladsl.Source<T,Mat>,scala.concurrent.Future<scala.runtime.BoxedUnit>,scala.concurrent.Future<scala.runtime.BoxedUnit>,akka.stream.KillSwitch> captureMaterializationTerminationAndKillSwitch(akka.stream.scaladsl.Source<T,Mat> source)
-
sliceBytesTransformer
public static akka.stream.scaladsl.Flow<akka.util.ByteString,akka.util.ByteString,akka.NotUsed> sliceBytesTransformer(long start, long length)
-
limitByteChunksStage
public static akka.stream.stage.GraphStage<akka.stream.FlowShape<akka.util.ByteString,akka.util.ByteString>> limitByteChunksStage(int maxBytesPerChunk)
-
delayCancellation
public static <T> akka.stream.scaladsl.Flow<T,T,akka.NotUsed> delayCancellation(scala.concurrent.duration.Duration cancelAfter)
INTERNAL APIReturns a flow that is almost identity but delays propagation of cancellation from downstream to upstream.
- Parameters:
cancelAfter
- (undocumented)- Returns:
- (undocumented)
-
statefulAttrsMap
public static <T,U> akka.stream.scaladsl.Flow<T,U,akka.NotUsed> statefulAttrsMap(scala.Function1<akka.stream.Attributes,scala.Function1<T,U>> functionConstructor)
Lifts the streams attributes into an element and passes them to the function for each passed through element. Similar idea thanFlowOps.statefulMapConcat
but for a simple map.The result of
Attributes => (T => U)
is cached, and only theT => U
function will be invoked afterwards for each element.- Parameters:
functionConstructor
- (undocumented)- Returns:
- (undocumented)
-
OnlyRunInGraphInterpreterContext
public static akka.stream.Materializer OnlyRunInGraphInterpreterContext()
Dummy name to signify that the caller asserts that cancelSource is only run from within a GraphInterpreter context
-
cancelSource
public static void cancelSource(akka.stream.scaladsl.Source<?,?> source, akka.stream.Materializer materializer)
Tries to guess whether a source needs to cancelled and how. In the best case no materialization should be needed.- Parameters:
source
- (undocumented)materializer
- (undocumented)
-
transformEntityStream
public static <T extends HttpEntity,M> scala.Tuple2<T,M> transformEntityStream(T entity, StreamUtils.EntityStreamOp<M> streamOp)
-
encodeErrorAndComplete
public static <T> akka.stream.scaladsl.Flow<T,T,akka.NotUsed> encodeErrorAndComplete(scala.Function1<java.lang.Throwable,T> f)
-
-