package myPro1;
import java.io.*;
//读取一行,如:张三=5000
//装饰者模式
public class T2Main {
public static void main(String[] args) {
FileReader fr = null;
BufferedReader br = null;
try {
fr = new FileReader("C:/salary.txt");//节点流
br = new BufferedReader(fr);
//装饰者模式,在FileReader基础上,实现更多功能
while (true) {// 循环读取所有行,并打印
String line = br.readLine();// 读取一行
if (line == null) {//为空,跳出循环
break;
}
System.out.println(line);
}
} catch (Exception e) {
System.out.println(e);
} finally {// 关闭流
try {
fr.close();
br.close();
} catch (Exception e2) {
System.out.println(e2);
}
}
}
}