Reading a whole file at once
suggest changeFile f = new File(path);
String content = new Scanner(f).useDelimiter("\\Z").next();
\Z is the EOF (End of File) symbol. When set as the delimiter, the Scanner reads the file until EOF. Close the Scanner when you are done.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents