Created
August 31, 2011 11:55
-
-
Save k4200/1183377 to your computer and use it in GitHub Desktop.
printToFileを使った例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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