字符缓冲流BufferedWriter BufferedReader
//字符缓冲流主要用于文本数据的高速写入
package cn.lijun.demo1; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; public class BufferedReaderDemo { public static void main(String[] args) throws Exception { //创建字符输入缓冲流对象 BufferedReader bf=new BufferedReader(new FileReader("d:\\b.txt")); String len=null; while((len=bf.readLine())!=null){ System.out.println(len); } bf.close(); } } //字节输出缓冲流 package cn.lijun.demo1; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; public class BufferedWriterDemo { public static void main(String[] args) throws IOException { //创建字符输出流 封装文件 FileWriter fw=new FileWriter("d:\\b.txt"); BufferedWriter bw = new BufferedWriter(fw); bw.write("您好"); bw.newLine(); //换行 bw.write(100); bw.flush(); bw.write("adasfdsf"); bw.close(); } }