关于java:java8-stream方式读取文件

5次阅读

共计 254 个字符,预计需要花费 1 分钟才能阅读完成。

`

@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("",""));
     });
}

`

正文完
 0