1.網絡下載文件
1 URL url = new URL(strUrl); 2 3 HttpURLConnection httpconn = (HttpURLConnection)url.openConnection(); 4 5 httpconn.getContentLength();
2.本地文件
1 InputStream inputStream = urlCon.getInputStream(); 2 3 inputStream.available();
來源:http://hold-on.iteye.com/blog/1017449