首页 > 其他分享 >读取文件内容

读取文件内容

时间:2022-10-11 16:03:10浏览次数:33  
标签:文件 读取 StringBuilder fileName 内容 stringBuilder line String

//从文件夹里面获取数据
String fileName = "C:\\Users\\Administrator\\Desktop\\启奥接口成功返回.txt";
//一行一行读取
List<String> lines = Files.readAllLines(Paths.get(fileName), StandardCharsets.UTF_8);
StringBuilder stringBuilder = new StringBuilder();
for (String line : lines) {
stringBuilder.append(line);
}

标签:文件,读取,StringBuilder,fileName,内容,stringBuilder,line,String
From: https://www.cnblogs.com/YCL-/p/16779505.html

相关文章