URL url = new URL(pic);
HttpURLConnection httpconn = (HttpURLConnection) url.openConnection();
httpconn.connect();
System.out.println(httpconn.getContentLength());
ds = new DataInputStream(httpconn.getInputStream());
out = new DataOutputStream(new FileOutputStream(file));
int size = 0,j = 0;
while ((size = ds.read()) != -1) {
out.write(size);
j = j + size;
//System.out.println(size);
show(j,httpconn);
}
System.out.println("大小为:"+j);输出结果为256225
大小为:32547285为什么 J 的大小和返回的大小不一样呢