Created
May 17, 2019 10:02
-
-
Save matteo-grella/0e212dce08f54bfa86fcedb3843cbb48 to your computer and use it in GitHub Desktop.
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
/** | |
* @param resource the path to the resource to load | |
* | |
* @return the content of the resource | |
*/ | |
fun loadResource(resource: String): String = | |
try { | |
object {}.javaClass.getResource(resource).readText(Charsets.UTF_8) | |
} catch (all: Exception) { | |
throw RuntimeException("Failed to load resource=$resource!", all) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment