public String readToString(String fileName) {
String encoding = "UTF-8";
File file = new File(fileName);
Long filelength = file.length();
byte[] filecontent = new byte[filelength.intValue()];
try {
FileInputStream in = new FileInputStream(file);
in.read(filecontent);
return new String(filecontent, encoding);
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
in.close;
}
}
浙公网安备 33010602011771号