Finally got the time to search thru the JDK codebase - at the moment JDK8 due the lack of a working Netbeans Project for JDK9 (I will try to make that working again)
>> 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[]) not referred within the JDK at all > java.io.InputStream#read(byte[], int, int) I found around 190 usage references in total of those there are the following 28 references that could use my proposed copy feature and 5 of those use 8192 bytes sized buffers. The short list following shows the path to the resource, line where the byte buffer is initialized and the buffer size taken jdk/src/solaris/classes/sun/print/UnixPrintJob.java 589 / 1024 jdk/src/windows/classes/sun/print/Win32PrintJob.java 444 / 1024 jdk/src/share/classes/sun/security/provider/X509Factory.java 119 / 2048 jdk/src/share/classes/com/sun/media/sound/JavaSoundAudioClip.java 356 / 16384 jdk/src/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java 83 / 1024 jdk/src/share/classes/javax/swing/text/rtf/AbstractFilter.java 99 / 16384 jdk/src/share/classes/sun/net/NetworkServer.java 120 / 300 jdk/src/share/classes/sun/net/ftp/impl/FtpClient.java 1352 / 15000 jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java 2148 / 1024 jdk/src/share/classes/java/awt/Font.java 934 / 8192 jdk/src/share/classes/sun/security/provider/certpath/X509CertPath.java 259 / 8192 jdk/src/share/classes/com/sun/media/sound/AiffFileWriter.java 236 / 4096 jdk/src/share/classes/sun/net/www/MimeLauncher.java 118 / 2048 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignatureInput.java 492 / 4096 jdk/src/share/classes/java/util/jar/JarInputStream.java 109 / 8192 jdk/src/share/classes/sun/tools/jar/Main.java 822 / 8192 jdk/src/share/classes/javax/management/loading/MLet.java 1170 / 4096 jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java 1311 / 8192 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverDirectHTTP.java 144 / 4096 jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java 52 / 1024 jdk/src/share/classes/java/nio/file/Files.java 2906 / 8192 jdk/src/share/classes/sun/security/tools/keytool/Main.java 2140 / 4096 jdk/src/share/classes/com/sun/media/sound/ModelByteBuffer.java 194 / 1024 jdk/src/share/classes/sun/swing/SwingUtilities2.java 1566 / 1024 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/JavaUtils.java 140 / 4096 jdk/src/share/classes/com/sun/media/sound/SoftMixingClip.java 333 / multiple of 512 jdk/src/share/classes/com/sun/media/sound/StandardMidiFileWriter.java 141 / 16384 jdk/src/share/classes/com/sun/media/sound/WaveFileWriter.java 236 / 4096