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 ( ) ) ; } } }
Copies file src to dest using nio .