RFR: 8354724: BufferedReader readAllLines and readString methods [v8]

Brian Burkhalter bpb at openjdk.org
Tue Apr 22 15:42:32 UTC 2025


On Tue, 22 Apr 2025 15:34:43 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> src/java.base/share/classes/java/io/Reader.java line 401:
>> 
>>> 399:      * Reads all remaining characters into a string.
>>> 400:      *
>>> 401:      * <p> This method reads all content including the line separators in
>> 
>> Again, just to say that it's all remaining rather than "all content" as some characters may have been consumed before this method is invoked.
>> 
>> Now that you have readAllChars, I think it would be good to prototype a readAllLines (or better name) on Reader too. Consuming all characters means that Reader should not need to take on the characteristics of a buffered-Reader.
>
>> Again, just to say that it's all remaining rather than "all content" as some characters may have been consumed before this method is invoked.
> 
> Thanks, that was inadvertently overlooked. See 42e6f3b.
> 
>> Now that you have readAllChars, I think it would be good to prototype a readAllLines (or better name) on Reader too. Consuming all characters means that Reader should not need to take on the characteristics of a buffered-Reader.
> 
> Shall investigate. There had been some hesitation about introducing the concept of a "line" to `Reader`, but with `readAllChars` we have rather dispensed with that.

And more: 1bbb7b1.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2054379507


More information about the core-libs-dev mailing list