Citation :
public static void copyFileBuffered(final String currentFile, final String newFile, final int bufferSize) throws FileNotFoundException, IOException { System.out.println("On copie "+currentFile+ "vers "+newFile );
final BufferedReader in = new BufferedReader(new FileReader(currentFile), bufferSize * 1024); try { final BufferedWriter out = new BufferedWriter(new FileWriter(newFile), bufferSize * 1024); try { int s = in.read(); while(s != -1) { out.write(s); s = in.read(); }//end while out.flush(); } finally { out.close(); }//end try } finally { in.close(); }//end try }//end copyFileBuffered
|