Last active
May 11, 2016 00:20
-
-
Save gustavomdsantos/27c6e6d79a7d0e9de0d5ce129bf3330d to your computer and use it in GitHub Desktop.
The simplest way to read a file to String in Java, based on http://stackoverflow.com/a/3403112
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
private static String readFile(String filename) throws FileNotFoundException { | |
return new Scanner(new File(filename)).useDelimiter("\\Z").next(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment