Created
May 10, 2019 04:41
-
-
Save jknair0/d4a261eb5a31c0892d0cdf2e59535146 to your computer and use it in GitHub Desktop.
Read test resource file
This file contains hidden or 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
| fun readContent(fileNameWithExt: String): String? { | |
| return try { | |
| val classLoader = javaClass.classLoader | |
| val resource = classLoader.getResource(fileNameWithExt) | |
| val file = File(resource.file) | |
| file.readText() | |
| } catch (e: Exception) { | |
| null | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment