java8 stream方式读取文件
文章目录
`
@Test
public void readFile() throws IOException {
String fileName = "F:/sdata企业名.txt";
//读取文件
Stream<String> stringStream = Files
.lines(Paths.get(fileName), Charset.defaultCharset());
stringStream.limit(10000).forEach(line -> {
System.out.println(line.replace(" ", ""));
});
}`
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论