cdm/src/main/java/ucar/nc2/util/IO.java
static public void copyFile(String fileInName, String fileOutName) throws IOException {
    try (FileInputStream fin = new FileInputStream(fileInName);
         FileOutputStream fout = new FileOutputStream(fileOutName)) {

      InputStream in = new BufferedInputStream(fin);
      OutputStream out = new BufferedOutputStream(fout);
      IO.copy(in, out);
    }
  }
static public void copyFile(String fileInName, String fileOutName) throws IOException {
    try (FileInputStream fin = new FileInputStream(fileInName);
         FileOutputStream fout = new FileOutputStream(fileOutName)) {

      InputStream in = new BufferedInputStream(fin);
      OutputStream out = new BufferedOutputStream(fout);
      IO.copy(in, out);
    }
  }
static public void copyFile ( String fileInName , String fileOutName ) throws IOException { try ( FileInputStream fin = new FileInputStream ( fileInName ) ; FileOutputStream fout = new FileOutputStream ( fileOutName ) ) { InputStream in = new BufferedInputStream ( fin ) ; OutputStream out = new BufferedOutputStream ( fout ) ; IO . copy ( in , out ) ; } }
copy one file to another.

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