日期:2014-05-20 浏览次数:20820 次
package Demo;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
/*
* 需求:使用BufferedReader和BufferedWriter实现文件的拷贝
*/
public class Demo8 {
public static void main(String[] args) throws IOException {
FileReader fr = new FileReader("D:/diyssh.pbk");
BufferedReader br = new BufferedReader(fr);
FileWriter fw = new FileWriter("D:/diyssh.pbk1");
BufferedWriter bw = new BufferedWriter(fw);
int x = 0;
while((x = br.read())!=-1){
bw.write(x);
}
bw.close();
br.close();
}
}