在 java 中,我必须阅读多个文件来搜索一些文本。文件包含大量 html 数据,因此在以下代码的帮助下很难读取 html 文件的内容。是使用 java 获取文件内容的任何直接方法。我正在使用以下代码,但它使我的应用程序变慢建议我使用它的最佳替代方案
try{
FileReader fr=new FileReader("path of the html file");
BufferedReader br= new BufferedReader(fr);
String content="";
while((s=br.readLine())!=null)
{
content=content+s;
}
System.out.println("content is"+content);
}
catch(Exception ex)
{
}