/**
* 读入TXT文件
*/
public List<String> readFile(String pathName) {
List<String> list = new ArrayList<>();
try {
InputStream stream = getClass()
.getClassLoader()
.getResourceAsStream(pathName);
BufferedReader read = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
String line;
while ((line = read.readLine()) != null) {
// 一次读入一行数据
list.add(line);
}
return list;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}