//先将字节流转换成转换流
OutputStreamWriter out1 = new OutputStreamWriter(new FileOutputStream("GBK.txt"));//把转换流转换成字符流
BufferedWriter out2 = new BufferedWriter(out1);
//以上合成一步
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("GBK.txt")));
谨记:字符流只能读写文本文件
字节流可以读写各种二进制文件(图片、视频……)以及读写文本文件
|
|