这是我显示问题的简单测试代码:
URL u = new URL(someURLString);
URLConnection c = u.openConnection();
InputStream is = c.getInputStream();
int amount = c.getContentLength(); //gives 75830, which is correct
int r = 0;
while (is.read() != -1) //count input
r++;
//r is 65878, what the hell?
显然有数据丢失。谁能解释这种行为?
先感谢您