Created
January 29, 2017 00:18
-
-
Save salishdev/830803e7b9dffed0aba8436646b906ee to your computer and use it in GitHub Desktop.
scala: load files from resources directory
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
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