On Thu, 15 May 2025 20:34:13 GMT, Brian Burkhalter <b...@openjdk.org> wrote:
>> @stuart-marks Sorry, didn't want to pull you in here, that's why I said, I >> am just *paraphrasing*. >> >> That is correct, it is a different case, but the *final effect* for the >> caller is the same: If he needs to now whether a copy is made *or not*, he >> needs to have JavaDocs telling him *how* the new method works inside >> (whether it calls `subSequence` or whether it calls `getChars`). Otherwise >> he might make false assumptions about the result. > > This API is concerned with the "what" and not so much the "how." The purpose of Reader and subclasses is to normalize characters in various forms (char arrays, byte streams, char buffers, etc) into a coherent stream of characters and be able to read it incrementally. If the caller is going to use the entire CharSequence, as in the case of `Reader.of(cs)`, there is no reason to have a reader at all. Both String and CharSequence have more useful APIs than Reader for parsing. The motivation for reading all characters and reading lines came from use cases around input from sub-processes where the input is decoded from a byte stream, but that's not `Reader.of(cs).` ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2093611355