code: private static void copy(InputStream source, OutputStream sink) throws IOException {
          byte[] buf = new byte[8192];
          int n;
          while ((n = source.read(buf)) > 0) {
              sink.write(buf, 0, n);
          }
      }
docs: Based on the {@code private} {@link java.nio.file.Files#copy(InputStream, OutputStream)}. This
  implementation is included here to avoid depending on Apache Commons IO just for this simple case.