public static void copyFile(File source,File target) throws IOException {
  FileInputStream fis=new FileInputStream(source);
  FileOutputStream fos=new FileOutputStream(target);
  byte[] buf=new byte[1024];
  int i=0;
  while ((i=fis.read(buf)) != -1) {
    fos.write(buf,0,i);
  }
  fis.close();
  fos.close();
}

public static void copyFile ( File source , File target ) throws IOException { FileInputStream fis = new FileInputStream ( source ) ; FileOutputStream fos = new FileOutputStream ( target ) ; byte [ ] buf = new byte [ 1024 ] ; int i = 0 ; while ( ( i = fis . read ( buf ) ) != - 1 ) { fos . write ( buf , 0 , i ) ; } fis . close ( ) ; fos . close ( ) ; }
copies a source file to a target file .
