读取TXT
public static List<String[]> readTxt(String txtName) throws Exception {
File directory = new File("");
String mydir = directory.getAbsolutePath();
String str = mydir + "\\config\\MMIConfig\\" + txtName;
BufferedReader reader = null;
String temp = null;
try {
List<String[]> txtList = new ArrayList<>();
reader = new BufferedReader(new InputStreamReader(new FileInputStream(str), "GBK"));
while ((temp = reader.readLine()) != null) {
if(temp.equals("")) continue;
if(temp.startsWith("//")) continue;
if(temp.equals("[END]")) break;
String[] arr = temp.split(",");
txtList.add(arr);
}
return txtList;
} catch (Exception e) {
e.printStackTrace();
throw new Exception("read txt fail!", e);
} finally {
reader.close();
}
}