Skip to content

Instantly share code, notes, and snippets.

@silverbeak
Created March 5, 2018 07:52
Show Gist options
  • Select an option

  • Save silverbeak/30b5141747a7d3550755417d4e869fe5 to your computer and use it in GitHub Desktop.

Select an option

Save silverbeak/30b5141747a7d3550755417d4e869fe5 to your computer and use it in GitHub Desktop.
Read resource file using Scala
/**
* I do this often enough to merit a Gist, but not often enough to remember by heart. Maybe someone else has the same problem.
* The ".mkstring" part can of course be altered to something else as needed, if you don't want a String
*/
import scala.io.Source
val jsonMsg: String = Source.fromURL(getClass.getResource("/json/test1.json")).mkString
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment