public static void copyFile(final File fromFile,final File toFile) throws UncheckedIOException {
  InputStream from=null;
  OutputStream to=null;
  try {
    from=new FileInputStream(fromFile);
    to=new FileOutputStream(toFile);
    copyStream(from,to);
  }
 catch (  IOException e) {
    throw new UncheckedIOException(e);
  }
 finally {
    if (from != null) {
      try {
        from.close();
      }
 catch (      IOException ignored) {
        ignored.printStackTrace();
      }
    }
    if (to != null) {
      try {
        to.close();
      }
 catch (      IOException ignored) {
        ignored.printStackTrace();
      }
    }
  }
}

public static void copyFile ( final File fromFile , final File toFile ) throws UncheckedIOException { InputStream from = null ; OutputStream to = null ; try { from = new FileInputStream ( fromFile ) ; to = new FileOutputStream ( toFile ) ; copyStream ( from , to ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } finally { if ( from != null ) { try { from . close ( ) ; } catch ( IOException ignored ) { ignored . printStackTrace ( ) ; } } if ( to != null ) { try { to . close ( ) ; } catch ( IOException ignored ) { ignored . printStackTrace ( ) ; } } } }
copies the file content from one file to the other file .
