playframework/Play20 — pull request #506 by gre (2012-10-31 13:45:39+00:00)
Title: Add Enumerator.outputStream

Here is a clean one commit pull request of Enumerator.outputStream
See https://github.com/playframework/Play20/pull/487

Use case:
```
def zip = Action {
import play.api.libs.iteratee._
import java.util.zip._

val enumerator = Enumerator.outputStream { os =>
var zip = new ZipOutputStream(os);
zip.putNextEntry(new ZipEntry("README.txt"))
zip.write("~~~ This README file contained in a zip has been generated with Play2 Enumerator.outputStream combined with java's ZipOutputStream ~~~".map(_.toByte).toArray)
zip.closeEntry()
zip.close()
}
Ok.stream(enumerator >>> Enumerator.eof).withHeaders(
"Content-Type"->"application/zip",
"Content-Disposition"->("attachment; filename=test.zip")
)
}
```