RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v25]
Chen Liang
liach at openjdk.org
Wed May 21 21:42:04 UTC 2025
On Wed, 21 May 2025 19:18:03 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Implement the requested methods and add a test thereof.
>
> Brian Burkhalter has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 29 additional commits since the last revision:
>
> - 8354724: Update API notes
> - Merge
> - 8354724: Revert previous commit and remove first comma in the change
> - 8354724: Improve verbiage about I/O errors
> - 8354724: Replace getChars in previous commit with subSequence
> - 8354724: Improve readAllAsString method of Reader returned by Reader.of
> - 8354724: Change readAllCharsAsString as suggested; move test to proper location
> - 8354724: "stream" -> "reader"
> - 8354724: Attempt to further improve verbiage
> - Merge
> - ... and 19 more: https://git.openjdk.org/jdk/compare/c5a1d189...f9c732eb
src/java.base/share/classes/java/io/Reader.java line 460:
> 458: */
> 459: public List<String> readAllLines() throws IOException {
> 460: return readAllCharsAsString().lines().toList();
I recommend an implementation comment that we intentionally avoid delegating to `readAllAsString`, which can be overridden by subclasses. Otherwise, the purpose of `readAllCharsAsString` may not be immediately clear.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2101213305
More information about the core-libs-dev
mailing list