Skip to content

Instantly share code, notes, and snippets.

@banjeremy
Created January 29, 2017 00:18
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save banjeremy/830803e7b9dffed0aba8436646b906ee to your computer and use it in GitHub Desktop.
Save banjeremy/830803e7b9dffed0aba8436646b906ee to your computer and use it in GitHub Desktop.
scala: load files from resources directory
def loadResource(filename: String) = {
val source = scala.io.Source.fromURL(getClass.getResource(filename))
try source.mkString finally source.close()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment