public static void copyFile(File origPath,File destPath) throws IOException {
  try (FileInputStream ins=new FileInputStream(origPath);FileOutputStream outs=new FileOutputStream(destPath)){
    FileChannel in=ins.getChannel();
    FileChannel out=outs.getChannel();
    in.transferTo(0,in.size(),out);
  }
 }

public static void copyFile ( File origPath , File destPath ) throws IOException { try ( FileInputStream ins = new FileInputStream ( origPath ) ; FileOutputStream outs = new FileOutputStream ( destPath ) ) { FileChannel in = ins . getChannel ( ) ; FileChannel out = outs . getChannel ( ) ; in . transferTo ( 0 , in . size ( ) , out ) ; } }
convenience function to copy a file . if the destination file exists it is overwritten .
