Skip to content

Instantly share code, notes, and snippets.

@gakuzzzz
Last active December 30, 2015 10:20
Show Gist options
  • Save gakuzzzz/339f0118e301ff2953c2 to your computer and use it in GitHub Desktop.
Save gakuzzzz/339f0118e301ff2953c2 to your computer and use it in GitHub Desktop.
Enumerator to InputStream
val enumerator: Enumerator[Array[Byte]] = ...
val pos = new PipedOutputStream()
val pis = new PipedInputStream(pos)
Future { useInputStream(pis) }
val it = Iteratee.foreach(pos.write)
enumerator.onDoneEnumerating(pos.close()) |>>> it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment