Library enhancement proposal for copying data from/to Reader/Writer InputStream/OutputStream

Pavel Rappo pavel.rappo at oracle.com
Fri Nov 28 20:35:16 UTC 2014


> What usage would you actually search in the OpenJDK code base?

We're talking about copying with provided buffer, right?

long copy(InputStream source, OutputStream target, byte[] buffer)
                                                   ^^^^^^^^^^^^^
It would be very helpful to verify that this method is needed extremely rare,
if at all. In our case it would be an array of very specific
(other than 1024, 2048, 4096 or 8192) size, i.e. unusually large or small or
heavily reused one.

To copy from an input stream to an output stream you need to try to read a byte
from the input stream, at least once. Therefore search for usages of
these methods will be a good start:

java.io.InputStream#read(byte[])
java.io.InputStream#read(byte[], int, int)

-Pavel




More information about the core-libs-dev mailing list