Reading strings using BufferedReader.readLine() is too slow
- From: wicli_pucli@xxxxxxxxxxx
- Date: Thu, 28 Jun 2007 06:13:46 -0700
I have the following code for reading a string from an input stream:
BufferedReader in = new BufferedReader(
new InputStreamReader(
connection.getInputStream()));
reply = new String();
String reply_now;
while ((reply_now = in.readLine()) != null) {
reply += reply_now;
}
in.close();
The problem is it's too slow and takes too much CPU time because, as I
guess, it performs too many additions with strings and I can't find
any alternative way of reading streams - reliable and not using
deprecated methods. How can I read text from a stream in bigger
portions than lines?
.
- Follow-Ups:
- Re: Reading strings using BufferedReader.readLine() is too slow
- From: Roedy Green
- Re: Reading strings using BufferedReader.readLine() is too slow
- From: Roedy Green
- Re: Reading strings using BufferedReader.readLine() is too slow
- From: Gordon Beaton
- Re: Reading strings using BufferedReader.readLine() is too slow
- Prev by Date: Consume .net webservice
- Next by Date: Re: how to display java API document in eclipse
- Previous by thread: Consume .net webservice
- Next by thread: Re: Reading strings using BufferedReader.readLine() is too slow
- Index(es):
Relevant Pages
|
|