RFR: 8356420: Provide examples on wrapping System.in [v3]
Naoto Sato
naoto at openjdk.org
Mon May 12 21:17:53 UTC 2025
On Sun, 11 May 2025 16:46:42 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> 1. FileDescriptor.in: Unfortunately FileInputStream(FileDescriptor) has no overload that supports custom charsets. We should probably document both on this FD and that constructor.
The description of `FileDescriptor.in` reads:
Usually, this file descriptor is not used directly, but rather via the input stream known as System.in
And its `System.in` is hyperlinked. So I'd not add an example here.
> 2. JShell.in and JavaShellToolBuilder.in
(I assumed the first one as `JShell.Builder.in`)
These are not fields but methods to set the InputStream, so I don't think this example exercise applies to either. `jdk.jshell` package info has a code sample which uses `System.console()` instead of reading from `System.in` which is good.
> 3. A few usages in security, like password reading in sun.security.tools.keytool.Main, or javax.security.auth.callback.CallbackHandler
The former are within `sun` package which is internal, so no need for examples. The latter has code sample in the class description. In there:
new InputStreamReader(System.in)
So this one indeed need to be updated. Will address it in the next iteration.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25155#issuecomment-2874120922
More information about the core-libs-dev
mailing list