public static int copy(InputStream input, OutputStream output) throws IOException {
    byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
    long count = 0;
    int n = 0;
    while (-1 != (n = input.read(buffer))) {
      output.write(buffer, 0, n);
      count += n;
    }
    if (count > Integer.MAX_VALUE) {
      return -1;
    }
    return (int) count;
  }
Copy bytes from an <code>InputStream</code> to an <code>OutputStream</code>.

@param input the <code>InputStream</code> to read from
@param output the <code>OutputStream</code> to write to
@return the number of bytes copied
@throws NullPointerException if the input or output is null
@throws IOException if an I/O error occurs
@throws ArithmeticException if the byte count is too large
geode-core/src/main/java/org/apache/geode/internal/util/LogFileUtils.java