Last active
August 29, 2015 13:56
-
-
Save sebglazebrook/9198979 to your computer and use it in GitHub Desktop.
Read text file from a package
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
| // Quite different to ruby. Took me a little longer to find out how to do it than it should. | |
| def template(filename) { | |
| def input = getClass().getResourceAsStream("/path/to/package/${filename}.template") | |
| new InputStreamReader(input, 'utf-8') | |
| } | |
| // If file is in your 'resources' folder then use the below | |
| def templateFromResources(filename){ | |
| def input = getClass().getResourceAsStream("templates/${filename}.template") | |
| new InputStreamReader(input, 'utf-8') | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment