Estou tentando ler uma input stream usando as classes BufferedReader e InputStreamReader, mas a leitura do arquivo texto de várias linhas está demorando cerca de 30 segundos, ou seja, tempo pra caramba.
Aqui está o método:
public String getHtml() throws IOException
{
/**Obtém o conteúdo da página HTML e o retorna como uma String*/
long tempo = System.currentTimeMillis();
URLConnection site = getConnection();
BufferedReader reader = new BufferedReader( new InputStreamReader( site.getInputStream() ) );
System.out.println("Tempo para baixar a URL: "+(System.currentTimeMillis()-tempo));
String html = "";
tempo = System.currentTimeMillis();
String linha = "";
while( ( linha = reader.readLine() ) != null )
{
html += linha;
}
System.out.println("Tempo para gerar o HTML: " + (System.currentTimeMillis()-tempo) );
return html;
}
Quais outras formas de leitura recomendam?
