static void copyInputStreamToFile(InputStream original,File copy) throws IOException {
  if (original == null) {
    throw new IOException("Could not read input to copy.");
  }
  createFile(copy);
  try (OutputStream outputStream=new FileOutputStream(copy)){
    int bytesRead;
    byte[] buffer=new byte[4096];
    while ((bytesRead=original.read(buffer)) > 0) {
      outputStream.write(buffer,0,bytesRead);
    }
  }
  finally {
    closeSilently(original);
  }
}

static void copyInputStreamToFile ( InputStream original , File copy ) throws IOException { if ( original == null ) { throw new IOException ( "Could not read input to copy." ) ; } createFile ( copy ) ; try ( OutputStream outputStream = new FileOutputStream ( copy ) ) { int bytesRead ; byte [ ] buffer = new byte [ 4096 ] ; while ( ( bytesRead = original . read ( buffer ) ) > 0 ) { outputStream . write ( buffer , 0 , bytesRead ) ; } } finally { closeSilently ( original ) ; } }
copies the content of the original input stream to the copy .
