1.网络下载文件 URL url = new URL(strUrl); HttpURLConnection httpconn = (HttpURLConnection)url.openConnection(); httpconn.getContentLength();2.本地文件 InputStream inputStream = urlCon.getInputStream(); inputStream.available();来源:http://hold-on.iteye.com/blog/1017449