BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("b.txt")));
1.BufferedWriter( 第一个里面也是Writer类型的,因为转换流是是其子类 )
这个用到了转换流,OutputStreamWriter,转换流的构造参数要用(OutputStream ops),因为FileOutputStream是OutputStream的子类,所以可以作为参数;
BufferedWriter bw2 = new BufferedWriter(new FileWriter("b.txt"));
2.这里就是普通的缓冲流创建方式。
|