标签:package 记录 file throws throw void new 行记录 oid
package io.day04;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class TestBuffer {
public static void main(String[] args) throws Exception {
buReader();
buWriter(); }
private static void buWriter() throws IOException {
BufferedWriter bw = new BufferedWriter (new FileWriter("src/b.txt"));
bw.write("来");
//刷新缓存
bw.flush();
//默认执行flush(),关闭管道
bw.close();
}
private static void buReader() throws Exception {
BufferedReader br = new BufferedReader (new FileReader("src/b.txt"));
//读取一行记录
// String str = br.readLine();
// str =br.readLine();
// System.out.println(str);
//读所有的 String str1;
while((str1=br.readLine())!=null){
System.out.println(str1);
}
br.close();
}
标签:package 记录 file throws throw void new 行记录 oid
原文地址:http://www.cnblogs.com/www123----/p/6832440.html