如何解析text文件里面的内容?
读取txt
public static String readTex(String path,String encoding){
BufferedReader reader = null;
StringBuilder sb = null;
try {
reader = new BufferedReader(new InputStreamReader(new FileInputStream(path),encoding));
sb = new StringBuilder();
int c;
c = reader.read();
while (c != -1) {
sb.append((char) c);
c = reader.read();
}
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
}
return sb.toString();
}