Skip to content

Instantly share code, notes, and snippets.

@fiadliel
Last active August 29, 2015 14:26
Show Gist options
  • Save fiadliel/5abd85c8163a404392af to your computer and use it in GitHub Desktop.
Save fiadliel/5abd85c8163a404392af to your computer and use it in GitHub Desktop.
Wrapper to create an outToSource function
object OutputStreamUtils {
def outToSource(queueSize: Int)(f: OutputStream => Unit)(implicit S: Strategy): Process[Task, ByteVector] = {
val queue = async.boundedQueue[ByteVector](queueSize)
val qos = new QueueOutputStream(queue)
S(f(qos))
queue.dequeue
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment