RFR: 8356420: Provide examples on wrapping System.in [v3]

Naoto Sato naoto at openjdk.org
Mon May 12 21:59:30 UTC 2025


On Mon, 12 May 2025 07:21:49 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Reflects another review comment
>
> src/java.base/share/classes/java/io/InputStreamReader.java line 54:
> 
>> 52:  * }
>> 53:  * This example also demonstrates how to wrap {@link System#in} with {@link
>> 54:  * System##stdin.encoding stdin.encoding}.
> 
> This example communicates two concerns, one is buffering, the other is the charset to use when running from System.in. I think we should separate these two, maybe with two examples?

Made it two examples.

> src/java.base/share/classes/java/util/Scanner.java line 82:
> 
>> 80:  *
>> 81:  * <p>This code reads lines from {@link System#in} with {@link
>> 82:  * System##stdin.encoding stdin.encoding}:
> 
> "from System.in with stdin.encoding" isn't very clear. I think you we can expand the sentence, or make it two sentences, so to that is uses a Scanner to read lines from System.in, and uses the value of stdin.encoding as the charset.

Made it two sentences.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25155#discussion_r2085595822
PR Review Comment: https://git.openjdk.org/jdk/pull/25155#discussion_r2085595798


More information about the core-libs-dev mailing list