Skip to content

Instantly share code, notes, and snippets.

@oxlade39
Created March 1, 2013 07:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oxlade39/5063137 to your computer and use it in GitHub Desktop.
Save oxlade39/5063137 to your computer and use it in GitHub Desktop.
Reading lines from an InputStream using a play.api.libs.iteratee.Enumerator
lazy val bufferedReader = new BufferedReader(new InputStreamReader(inputstream))
val responseStream: Enumerator[String] = Enumerator.generateM[String] {
Future{
logger.trace("about to read line")
val line: String = bufferedReader.readLine()
logger.trace("read line")
Option(line)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment