Last active
July 18, 2016 14:20
-
-
Save seveniu/8b2189e87d5ea53c406917d1342aa065 to your computer and use it in GitHub Desktop.
java 中获取 resource ,适用于 jar 内资源
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
InputStream in = getClass().getClassLoader().getResourceAsStream("ParseResult.groovy"); | |
BufferedReader reader = new BufferedReader(new InputStreamReader(in)); | |
StringBuilder builder = new StringBuilder(); | |
String aux = ""; | |
while ((aux = reader.readLine()) != null) { | |
builder.append(aux); | |
} | |
String text = builder.toString(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment