Skip to content

Instantly share code, notes, and snippets.

@k4200
Created August 31, 2011 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k4200/1183377 to your computer and use it in GitHub Desktop.
Save k4200/1183377 to your computer and use it in GitHub Desktop.
printToFileを使った例
// http://stackoverflow.com/questions/4604237/how-to-write-to-a-file-in-scala
FileUtils.printToFile(tempFile)(writer => {
val it = Source.fromFile(conf).getLines()
for (line <- it) {
startPattern.findFirstIn(line) match {
case Some(_) =>
while (it.hasNext && it.next.length != 0) {}
case _ =>
writer.println(line)
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment