private static String readFile(String filePath) {
File file = new File(filePath);
String content = "";
StringBuilder sb = new StringBuilder();
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), "GBK"));
while (content != null) {
content = br.readLine();
if (content == null) {
break;
}
sb.append(content.trim());
}
br.close();
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return sb.toString();
}
File file = new File(filePath);
String content = "";
StringBuilder sb = new StringBuilder();
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), "GBK"));
while (content != null) {
content = br.readLine();
if (content == null) {
break;
}
sb.append(content.trim());
}
br.close();
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return sb.toString();
}