code: 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);
    }
docs: copies the input stream to the output stream using a custom buffer size and applying additional stream handling
  
  @param inputStream
  the source stream
  @param outputStream
  the target stream
  @param buffer
  the custom buffer
  @param addtionalHandling
  a stream handler that allows additional handling of the stream
  @throws IOException