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

Roger Riggs rriggs at openjdk.java.net
Thu May 20 20:40:30 UTC 2021


On Thu, 20 May 2021 20:12:07 GMT, Rémi Forax <forax at openjdk.org> wrote:

> I don't think that using PrintWriter is a good idea here given that a PrintWriter shallow the IOException

Good point, but...

PrintStream does also and it is used frequently for Stdout and Stderr. 

OutputStreamWriter would be a better choice with that in mind. It does not have the convenience methods for converting various types to strings but would not hide the exceptions. Developers could wrap it in a PrintWriter to get the convenience and take on the responsibility of dealing with exceptions by polling.

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

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


More information about the core-libs-dev mailing list