On Fri, 16 May 2025 20:00:53 GMT, Roger Riggs <rri...@openjdk.org> wrote:
>> 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).` In many situations the programmer has no choice whether to use a reader or not, as the code he works in must fulfill a given specification (like JAX-RS), so he is getting a `Reader` *whether needed or not* -- it is not under *his* control. But as he wants to get *all* content, he likes to use this new method. Pretty valid and frequent use case in the enterprise world. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2093982275