RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

Markus KARG duke at openjdk.org
Wed May 14 19:47:56 UTC 2025


On Wed, 14 May 2025 18:16:22 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: Replace getChars in previous commit with subSequence

src/java.base/share/classes/java/io/Reader.java line 206:

> 204:                 ensureOpen();
> 205:                 int len = cs.length();
> 206:                 String result = cs.subSequence(next, len).toString();

Are you sure that `subSequence` is more efficient that `getChars`? Otherwise I do not see why replacing it.

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

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


More information about the core-libs-dev mailing list