public List<String> convertStreamToString(MultipartFile file){
List<String> list = new ArrayList<>();
try (InputStream inputStream = file.getInputStream()) {
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
String line;
try {
while ((line = reader.readLine()) != null) {
list.add(line);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
} catch (IOException e) {
e.printStackTrace();
}
return list;
}
springmvc读取txt文件
最新推荐文章于 2021-06-04 09:23:17 发布