Java: how to read BufferedReader faster

Posted by Cata on Stack Overflow See other posts from Stack Overflow or by Cata
Published on 2011-01-12T08:44:27Z Indexed on 2011/01/12 8:53 UTC
Read the original article Hit count: 215

Filed under:
|
|

Hello,

I want to optimize this code:

InputStream is = rp.getEntity().getContent();      

BufferedReader reader = new BufferedReader(new InputStreamReader(is));

String text = "";
String aux = "";

while ((aux = reader.readLine()) != null) {
        text += aux;
      }

The thing is that i don't know how to read the content of the bufferedreader and copy it in a String faster than what I have above. I need to spend as little time as possible. Thank you

© Stack Overflow or respective owner

Related posts about java

Related posts about optimization