Hello!

When closing a Process, its stdout and stderr are drained: The remaining bytes are copied into an array, and then the out/err stream is replaced with ByteArrayInputStream().

In a case when a fewer number of bytes were read then the Stream.available() suggested, the array is reallocated with Arrays.copyOf().

It is possible to avoid reallocation, and use three-args ByteArrayInputStream() constructor to specify a portion of the array used.

Would you please help review this trivial fix?

BUGURL: https://bugs.openjdk.java.net/browse/JDK-8203768
WEBREV: http://cr.openjdk.java.net/~igerasim/8203768/00/webrev/

All existing tests pass on all supported platforms.

Thanks in advance!

--
With kind regards,
Ivan Gerasimov

Reply via email to