/**
* 读取.txt文件
*
* @param path 文件路径
* @return txt文件内容
* @throws IOException IOException
*/
public static String readTxt(String path) throws IOException {
File file = new File(path);
if (!file.exists() || file.isDirectory()) {
throw new FileNotFoundException();
}
BufferedReader reader =
new BufferedReader(
new InputStreamReader(new FileInputStream(file), Constant.ENCODING_GBK));
StringBuilder builder = new StringBuilder();
String separator = System.getProperty("line.separator");
String temp = reader.readLine();
while (temp != null) {
temp = temp.trim();
builder.append(temp).append(separator);
temp = reader.readLine();
}
reader.close();
return builder.toString();
}