本帖最后由 forward 于 2013-8-26 21:29 编辑
下面的代码怎样通过缓冲流来实现写效率的提高?球解决啊!
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
FileWriter fw=new FileWriter("c:\\ccy.txt");
fw.write("dafniaonfioanf\r\ndfnainfladnfio");
fw.close();
FileReader fr=new FileReader("c:\\ccy.txt");
char[] buf=new char[1024];
int num=0;
while((num=fr.read(buf))!=-1){
System.out.print(new String(buf,0,num));
}
}
|