public static void copy ( InputStream inputStream , final OutputStream outputStream , byte [ ] buffer , final StreamHandler addtionalHandling ) throws IOException { LOGGER . trace ( "copy(InputStream, OutputStream, byte[], StreamHandler)" ) ; LOGGER . debug ( "buffer size: {} bytes" , ( buffer != null ) ? buffer . length : "null" ) ; process ( inputStream , new StreamHandler ( ) { @ Override public void handleStreamBuffer ( byte [ ] buffer , int offset , int length ) throws IOException { outputStream . write ( buffer , offset , length ) ; if ( addtionalHandling != null ) { addtionalHandling . handleStreamBuffer ( buffer , offset , length ) ; } } } , buffer ) ; }
copies the input stream to the output stream using a custom buffer size and applying additional stream handling