W
wicli_pucli
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?
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?