# Java从BufferedReader一行一行读取数据

经常需要从BufferedReader读取数据,比如读取csv文件,就要装到BufferedReader里然后一行一行处理。

方法一:

BufferedReader buffered = new BufferedReader(reader);
String line;
while ((line = buffered.readLine()) != null) {
  System.out.println(line);
}

方法二:

BufferedReader buffered = new BufferedReader(reader);
Stream<String> lines = buffered.lines();
上次更新: 2023/8/18 23:39:36