On Fri, 9 May 2025 21:29:09 GMT, Naoto Sato <na...@openjdk.org> wrote:

>> With the introduction of `stdin.encoding` 
>> ([JDK-8350703](https://bugs.openjdk.org/browse/JDK-8350703)), some guidance 
>> for users to decode `System.in` would be desirable. Adding examples in the 
>> field description would help.
>
> 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 communicate two concerns, one is buffering, the other is the 
charset to use when running from System.in. I think we should separate these 
two, make with 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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25155#discussion_r2083997044
PR Review Comment: https://git.openjdk.org/jdk/pull/25155#discussion_r2083991533

Reply via email to