code: private long copyLarge(final InputStream input, final OutputStream output,
              final int bufferSize) throws IOException {
          final byte[] buffer = new byte[bufferSize];
          long count = 0;
          int n = 0;
          while (-1 != (n = input.read(buffer))) {
              output.write(buffer, 0, n);
              count += n;
          }
          log.debug("Copied bytes: {}", count);
          return count;
      }
docs: This is copied from Jakarta Commons IOUtils.  For some reason our series
  of atypical socket stream chains break without a flush after each of
  these calls, so it's added in.
  
  Copy bytes from a large (over 2GB) <code>InputStream</code> to an
  <code>OutputStream</code>.
  <p>
  This method buffers the input internally, so there is no need to use a
  <code>BufferedInputStream</code>.
  
  @param input  the <code>InputStream</code> to read from
  @param output  the <code>OutputStream</code> to write to
  @param bufferSize The size of the buffer to use.
  @return the number of bytes copied
  @throws NullPointerException if the input or output is null
  @throws IOException if an I/O error occurs
  @since Commons IO 1.3