List of usage examples for java.io FileWriter FileWriter
public FileWriter(FileDescriptor fd)
From source file:com.thinkit.operationsys.util.FileUtil.java
public static void copyFile(String src, String dest) { System.out.println("copy"); File f1 = new File(src); File f2 = new File(dest); //int b=0;//from w w w . ja v a2 s . c o m String line = ""; try { FileReader reader = new FileReader(f1); FileWriter writer = new FileWriter(f2); BufferedReader br = new BufferedReader(reader); BufferedWriter bw = new BufferedWriter(writer); while ((line = br.readLine()) != null) { System.out.println(line); bw.write(line); bw.newLine(); bw.flush(); } reader.close(); writer.close(); } catch (Exception e) { e.printStackTrace(); } }