2020-04-28 17:15:11 +08:00
# fromJavaStream
Stream the values from a Java 8 `Stream` , requesting the next value when there is demand.
@ref [Source operators ](../index.md#source-operators )
## Signature
The automatic replacement produces Markdown that caused the paradox task in sbt to timeout or event fail. So
this commit removes some operators with outpu too complex:
- ignored operators:
"ask.md",
"alsoTo.md",
"batchWeighted.md",
"buffer.md",
"actorRef.md",
"collect.md",
"collection.md",
"combine.md",
"completionTimeout.md",
"concat.md",
"from.md",
"fromMaterializer.md",
"map.md",
"merge.md",
"queue.md",
"log.md", // too many overloads, breaks `paradox` task
"throttle.md", // too many overloads, breaks `paradox` task
"idleTimeout.md", // too many overloads, breaks `paradox` task
"setup.md",
"watch.md",
"withBackoff.md",
"zip.md",
"zipWith.md",
"actorRefWithBackpressure.md"
- Ignored class when FQCN contains: Implicits, FlowOpsMat, SubSource, FlowOps, SubFlow, WithContext, DelayStrategy
- some extra manual cleanup on the committed operators.
2020-04-28 19:21:04 +02:00
@apidoc [StreamConverters.fromJavaStream ](StreamConverters$ ) { scala="#fromJavaStream [T,S< :java.util.stream.BaseStream[T,S]](stream:()=> java.util.stream.BaseStream[T,S]):akka.stream.scaladsl.Source[T,akka.NotUsed]" java="#fromJavaStream (akka.japi.function.Creator)" }
2020-04-28 17:15:11 +08:00
## Description
Stream the values from a Java 8 `Stream` , requesting the next value when there is demand. The iterator will be created anew
for each materialization, which is the reason the @scala [`method` ] @java [`factory` ] takes a @scala [`function` ] @java [`Creator` ] rather than an `Stream` directly.
2020-06-26 09:07:01 +02:00
You can use `Source.async` to create asynchronous boundaries between synchronous java stream and the rest of flow.
2020-04-28 17:15:11 +08:00
## Example
Scala
: @@snip [From.scala ](/akka-docs/src/test/scala/docs/stream/operators/source/From.scala ) { #from -javaStream }
Java
: @@snip [From.java ](/akka-docs/src/test/java/jdocs/stream/operators/source/From.java ) { #from -javaStream }
## Reactive Streams semantics
@@@div { .callout }
**emits** the next value returned from the iterator
**completes** when the iterator reaches its end
@@@