赞
踩
FileReader是Reader的子类,用于读取字符流。FileWriter是Writer的子类,是用来读取字符文件的便捷类。
public static void test()throws Exception{
File file = new File("e:/data.txt");
FileReader fileReader = new FileReader(new File("e:/test.txt"));
FileWriter fileWriter = new FileWriter(file);
char[] c = new char[1024];
int len;
while((len = fileReader.read(c)) != -1){
fileWriter.write(c,0,len);
}
fileReader.close();
fileWriter.flush();
fileWriter.close();
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。