RFR: 8354724: BufferedReader readAllLines and readString methods [v5]
Shaojin Wen
swen at openjdk.org
Fri Apr 18 02:28:44 UTC 2025
On Thu, 17 Apr 2025 23:07:35 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 two additional commits since the last revision:
>
> - 8354724: Increment copyright year in Reader
> - 8354724: Move readString from BufferedReader to Reader
src/java.base/share/classes/java/io/Reader.java line 424:
> 422: int n;
> 423: while ((n = read(str)) != -1) {
> 424: result.append(str, 0, n);
If the characters in the Reader are always Latin1, this process will convert the UTF16 char[] to the LATIN1 encoded byte[] value in the StringBuilder every time, which will cause unnecessary performance overhead.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2049918157
More information about the core-libs-dev
mailing list