public static String readTextFile(String fileName) {
try {
FileInputStream in = new FileInputStream(fileName);
int length = in.available();
byte[] buffer = new byte[length];
in.read(buffer);
in.close();
String content = EncodingUtils.getString(buffer, "UTF-8");
return content;
} catch (FileNotFoundException e) {
return "";
} catch (IOException e) {
return "";
}
}
該函數忽略一切錯誤。。。