public static void copyFile(String src,String dst) throws Exception {
  BufferedReader inFile=null;
  PrintWriter outFile=null;
  String line;
  try {
    inFile=new BufferedReader(new FileReader(src));
    outFile=new PrintWriter(new FileOutputStream(dst));
    while ((line=inFile.readLine()) != null)     outFile.println(line);
  }
  finally {
    if (inFile != null)     inFile.close();
    if (outFile != null)     outFile.close();
  }
}

public static void copyFile ( String src , String dst ) throws Exception { BufferedReader inFile = null ; PrintWriter outFile = null ; String line ; try { inFile = new BufferedReader ( new FileReader ( src ) ) ; outFile = new PrintWriter ( new FileOutputStream ( dst ) ) ; while ( ( line = inFile . readLine ( ) ) != null ) outFile . println ( line ) ; } finally { if ( inFile != null ) inFile . close ( ) ; if ( outFile != null ) outFile . close ( ) ; } }
copy a text file
