Skip to content

Instantly share code, notes, and snippets.

@LenarBad
Created December 5, 2017 19:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LenarBad/1ad6677e3255a7148b71347a0e71c6a9 to your computer and use it in GitHub Desktop.
Save LenarBad/1ad6677e3255a7148b71347a0e71c6a9 to your computer and use it in GitHub Desktop.
How to read file into String with Google Guava
public String getFileIntoStringGuava(String fileName) throws IOException {
InputStream input = this.getClass().getResourceAsStream("/" + fileName);
return CharStreams.toString(new InputStreamReader(input, StandardCharsets.UTF_8));
}
@LenarBad
Copy link
Author

LenarBad commented Dec 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment