RFR: 8191441: (Process) add Readers and Writer access to java.lang.Process streams [v4]

Naoto Sato naoto at openjdk.java.net
Wed May 26 21:42:14 UTC 2021


On Tue, 25 May 2021 16:53:28 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Methods are added to java.lang.Process to read and write characters and lines from and to a spawned Process.
>> The Charset used to encode and decode characters to bytes can be specified or use the
>> operating system native encoding as is available from the "native.encoding" system property.
>
> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Described charset mapping of malformed chars in outputWriter
>   Repeated calls to  inputReader, errorReader, and outputWriter now return the same instance
>   and check for inconsistent charset argument
>   Added warnings about concurrently use of input/output streams and readers/writers.

src/java.base/share/classes/java/lang/Process.java line 254:

> 252:      * {@code
> 253:      *     return new BufferedReader(new InputStreamReader(getInputStream(), charset));
> 254:      * }

Does not seem to be equivalent any longer. Also, should it describe the behavior that it rejects the different Charset after the first invocation?

src/java.base/share/classes/java/lang/Process.java line 326:

> 324:      * {@code
> 325:      *     return new BufferedReader(new InputStreamReader(getErrorStream(), charset));
> 326:      * }

Same comment in `inputReader(Charset)` stands here too.

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

PR: https://git.openjdk.java.net/jdk/pull/4134


More information about the core-libs-dev mailing list