字符缓冲输出流
字符缓冲输出流
public static void main(String[] args) throws IOException {
// 字符缓冲输出流
BufferedWriter bw = new BufferedWriter(new FileWriter("D:\\b.txt"));
// 写出数据
bw.write(97);
bw.write("\r\n");
char[] chars = {97, 98, 99, 100, 101};
bw.write(chars);
bw.write("\r\n");
bw.write(chars, 0, 3);
bw.write("\r\n");
bw.write("黑马程序员abc");
bw.write("\r\n");
String line = "abcdefg";
bw.write(line, 0, 5);
bw.flush();
bw.close();
}