code: public static int copy(InputStream in, OutputStream out) throws IOException {
          int total = 0;
          byte[] buffer = new byte[8192];
          int c;
          while ((c = in.read(buffer)) != -1) {
              total += c;
              out.write(buffer, 0, c);
          }
          return total;
      }
docs: Copies all of the bytes from {@code in} to {@code out}. Neither stream is closed.
  Returns the total number of bytes transferred.