Skip to content

Instantly share code, notes, and snippets.

@retrography
Created June 21, 2014 17:07
Show Gist options
  • Save retrography/9c213cef24156a6c41e3 to your computer and use it in GitHub Desktop.
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
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