java - Android BufferedReader does not read the whole response -
i have problem reading ulr response. on android reads around half of response.
if use same code in normal java project works fine.
try { string _output = null; url url = new url("http://example.com"); bufferedreader buffer = new bufferedreader(new inputstreamreader(url.openstream())); stringbuilder = new stringbuilder(); string line; while ((line = buffer.readline()) != null) { everything.append(line); } _output = everything.tostring(); buffer.close(); system.out.print(_output); } catch (ioexception e) { e.printstacktrace(); }
how know it's half of response? if rely on printed system.out.println()
should aware logcat has limitation prevents printing more 4,000 characters. after truncated. check how of response have, print everything.length()
first, ot see if in situation.
you can @ this existing question on reference, there many others.
Comments
Post a Comment