RFR (JDK11/NIO) 8201276: (fs) Add methods to Files for reading/writing a string from/to a file

Alan Bateman Alan.Bateman at oracle.com
Fri Apr 27 11:13:52 UTC 2018

On 27/04/2018 05:50, Joe Wang wrote:
> Hi,
> We're looking into adding methods to Files to read a file into a 
> String/write a String to a file. Below is the current proposal. Please 
> review.
> JBS: https://bugs.openjdk.java.net/browse/JDK-8201276
> webrev: http://cr.openjdk.java.net/~joehw/jdk11/8201276/webrev/
> specdiff: 
> http://cr.openjdk.java.net/~joehw/jdk11/8201276/specdiff/java/nio/file/Files.html
The javadoc for these 4 methods looks okay. It might be helpful to 
include something in the readString javadoc to make it absolutely clear 
that the String may include line separators. I assume the "Note that .." 
paragraph can be changed to an @apiNote.

I assume you'll add "@since 11" to the readString methods.

It would be good to keep the existing formatting/style consistent with 
the existing code if you can, e.g. <p> tags, 4 space indent rather than 
8 for the throws, etc.

I can't tell from your mail if you are just looking for feedback on the 
current implementation + tests or just the API. I assume there are 
alternatives to using StringBuilder for the readString methods for example.


More information about the core-libs-dev mailing list