将整个 html 文件读取到字符串?
有没有比以下更好的方法将整个html文件读取到单个字符串变量:
String content = "";
try {
BufferedReader in = new BufferedReader(new FileReader("mypage.html"));
String str;
while ((str = in.readLine()) != null) {
content +=str;
}
in.close();
} catch (IOException e) {
}