RFR: 8356420: Provide examples on wrapping System.in [v2]
Roger Riggs
rriggs at openjdk.org
Fri May 9 21:12:53 UTC 2025
On Fri, 9 May 2025 20:39:27 GMT, Naoto Sato <naoto at 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 a review comment
src/java.base/share/classes/java/lang/System.java line 135:
> 133: * {@snippet lang=java :
> 134: * new InputStreamReader(System.in, System.getProperty("stdin.encoding"));
> 135: * }
So, ok as far as it goes. Does this example imply that one should always use the 2 arg constructor.
When should the 1-arg constructor that uses the defaultEncoding vs the 2-arg constructor with stdin.encoding be used?
Is that understood to be described elsewhere?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25155#discussion_r2082502132
More information about the core-libs-dev
mailing list