cdm/src/main/java/ucar/nc2/util/IO.java
static public void copyFile(File fileIn, File fileOut) throws IOException {
    try (FileInputStream fin = new FileInputStream(fileIn);
         FileOutputStream fout = new FileOutputStream(fileOut)) {
      InputStream in = new BufferedInputStream(fin);
      OutputStream out = new BufferedOutputStream(fout);
      IO.copy(in, out);
    }
  }
static public void copyFile(File fileIn, File fileOut) throws IOException {
    try (FileInputStream fin = new FileInputStream(fileIn);
         FileOutputStream fout = new FileOutputStream(fileOut)) {
      InputStream in = new BufferedInputStream(fin);
      OutputStream out = new BufferedOutputStream(fout);
      IO.copy(in, out);
    }
  }
static public void copyFile ( File fileIn , File fileOut ) throws IOException { try ( FileInputStream fin = new FileInputStream ( fileIn ) ; FileOutputStream fout = new FileOutputStream ( fileOut ) ) { InputStream in = new BufferedInputStream ( fin ) ; OutputStream out = new BufferedOutputStream ( fout ) ; IO . copy ( in , out ) ; } }
copy one file to another.

@param fileIn  copy from this file, which must exist.
@param fileOut copy to this file, which is overrwritten if already exists.
@throws java.io.IOException on io error
copy one file to another .