public static void fileCopy(final File src, final File dest, final boolean overwrite) throws IOException {
        if (!dest.exists() || (dest.exists() && overwrite)) {
            // Create parent directory structure if necessary
            FileUtils.mkParentDirs(dest);

            if (overwrite) {
                Files.copy(src.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
            } else {
                Files.copy(src.toPath(), dest.toPath());
            }
        }
    }
public static void fileCopy ( final File src , final File dest , final boolean overwrite ) throws IOException { if ( ! dest . exists ( ) || ( dest . exists ( ) && overwrite ) ) { FileUtils . mkParentDirs ( dest ) ; if ( overwrite ) { Files . copy ( src . toPath ( ) , dest . toPath ( ) , StandardCopyOption . REPLACE_EXISTING ) ; } else { Files . copy ( src . toPath ( ) , dest . toPath ( ) ) ; } } }
Copies file src to dest using nio.
@param src source file
@param dest destination file
@param overwrite true to overwrite if it already exists
@throws IOException on io error