public static void copy(File fromFile,File toFile,int bufSize) throws IOException {
  FileInputStream fis=new FileInputStream(fromFile);
  FileOutputStream fos=new FileOutputStream(toFile);
  if (bufSize <= 0) {
    bufSize=1024;
  }
  byte[] bytes=new byte[bufSize];
  int numRead;
  while ((numRead=fis.read(bytes)) > 0) {
    fos.write(bytes,0,numRead);
  }
  fis.close();
  fos.close();
}

public static void copy ( File fromFile , File toFile , int bufSize ) throws IOException { FileInputStream fis = new FileInputStream ( fromFile ) ; FileOutputStream fos = new FileOutputStream ( toFile ) ; if ( bufSize <= 0 ) { bufSize = 1024 ; } byte [ ] bytes = new byte [ bufSize ] ; int numRead ; while ( ( numRead = fis . read ( bytes ) ) > 0 ) { fos . write ( bytes , 0 , numRead ) ; } fis . close ( ) ; fos . close ( ) ; }
copy a file to another location , byte - wise .
