RFR: 8354724: BufferedReader readAllLines and readString methods [v11]
Alan Bateman
alanb at openjdk.org
Tue Apr 22 16:58:49 UTC 2025
On Tue, 22 Apr 2025 16:32:09 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Implement the requested methods and add a test thereof.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8354724: Add Reader.readAllLines; test not yet updated
src/java.base/share/classes/java/io/Reader.java line 403:
> 401: * by any one of a line feed ('\n'), a carriage return ('\r'), a carriage
> 402: * return followed immediately by a line feed, or by reaching the
> 403: * end-of-file (EOF).
Reader is for reading characters so I think the starting line will say that is reads all remaining characters as lines of text.
In any case, I think you've enough here to help decide if a method should be added to Reader. I think the main observation is that it doesn't require Reader to be buffering.
src/java.base/share/classes/java/io/Reader.java line 426:
> 424: */
> 425: public List<String> readAllLines() throws IOException {
> 426: return readAllChars().lines();
I assume you are missing toList() here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2054491331
PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2054487945
More information about the core-libs-dev
mailing list