Reading a whole file at once

suggest change
File 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.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents