RFR: 8354724: BufferedReader readAllLines and readString methods [v11]
Roger Riggs
rriggs at openjdk.org
Thu May 1 19:22:48 UTC 2025
On Tue, 22 Apr 2025 16:51:05 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> 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.
The description of the method should be the same in Reader and BufferedReader with respect to the behavior, line break handling, etc. It should be possible to use {@inheritDoc} to re-use it in BufferedReader.
Except for the description of the implementation, that can be in an {@impSpec} paragraph.
The method is consuming characters from the stream, assembling lines and returning list.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2070687773
More information about the core-libs-dev
mailing list