Created
June 21, 2014 17:07
-
-
Save retrography/9c213cef24156a6c41e3 to your computer and use it in GitHub Desktop.
The shortest way to read an entire text file into a string using Scala
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
object TextReader{ | |
def main(args: Array[String]) { | |
val file = scala.io.Source.fromFile(args(0), "utf-8") | |
val content = file.mkString | |
file.close | |
print(content) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment