import java.io.BufferedReader;
import java.io.FileReader;
import java.util.List;
import java.util.stream.Collectors;
public class TestJDKMethod {
/**
* 读取文件 并输入文件行包含 Exception 字段的行
* @param args
*/
public static void main(String[] args){
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader("d:\\a.log"));
List<String> exception = br.lines().peek(e -> {
}).filter(e -> {
return e.contains("Exception");
}).collect(Collectors.toList());
br.close();
System.out.println(exception);
} catch (Exception e) {
e.printStackTrace();
}
}
}
最后修改于 2020-09-08 17:13:41
如果觉得我的文章对你有用,请随意赞赏
扫一扫支付

