usage consumption by not reading the full response

  • Replies:0
Andy
  • Forum posts: 1

Jul 11, 2017, 9:08:47 PM via Website

Hi,
I want to read only part of a httpurlconnection response.

Now I have:

while ((line = reader.readLine()) != null) {
    sb.append(line);
}

I want to have:

while ((line = reader.readLine()) != null && !line.contains("blah") {
    sb.append(line);
}

Meaning, read until the line contains the word blah, then stop. Am I really reading less and improving the data consumption? If not, is there a way to stop reading to decrease consumption or the data is consumed no matter what?

Thanks

Reply