取得inputStream的长度

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

你可能感兴趣的:(取得inputStream的长度)