+doc documents how to use stream.io.Implicits

This commit is contained in:
Konrad Malawski 2015-04-24 15:52:27 +02:00
parent ed51c860e2
commit 538f0fb884
2 changed files with 18 additions and 2 deletions

View file

@ -6,10 +6,12 @@ package docs.stream.io
import java.io.File
import akka.stream._
import akka.stream.io.SynchronousFileSource
import akka.stream.io.SynchronousFileSink
import akka.stream.testkit._
import akka.stream.io.SynchronousFileSource
import akka.stream.scaladsl.Sink
import akka.stream.scaladsl.Source
import akka.stream.testkit.Utils._
import akka.stream.testkit._
import akka.util.ByteString
class StreamFileDocSpec extends AkkaSpec(UnboundedMailboxConfig) {
@ -54,4 +56,12 @@ class StreamFileDocSpec extends AkkaSpec(UnboundedMailboxConfig) {
.withAttributes(ActorOperationAttributes.dispatcher("custom-file-io-dispatcher"))
//#custom-dispatcher-code
}
"show Implicits" in {
//#source-sink-implicits
import akka.stream.io.Implicits._
Source.synchronousFile(file) to Sink.outputStream(() System.out)
//#source-sink-implicits
}
}

View file

@ -121,3 +121,9 @@ dispatcher for file IO operations globally, you can do so by changing the ``akka
or for a specific stage by spefifying a custom Dispatcher in code, like this:
.. includecode:: code/docs/stream/io/StreamFileDocSpec.scala#custom-dispatcher-code
If you would like to keep all sink and source factories defined on the :class:`Source` and :class:`Sink` objects
instead of using the separate objects contained in ``akka.strea.io`` to create these you can import an *implicit
coversion* that makes these operations available as shown below:
.. includecode:: code/docs/stream/io/StreamFileDocSpec.scala#source-sink-implicits