1、HttpURLConnection 获取下载文件大小
URL url = null;
String fileUrl = "http://XXXXX";
try {
url = new URL();
} catch (MalformedURLException e) {
e.printStackTrace();
}
HttpURLConnection urlcon = null;
try {
urlcon = (HttpURLConnection) url.openConnection();
int fileLength = urlcon.getContentLength();
log.d(TAG,"文件大小为:"+fileLength+"btye");
} catch (IOException e) {
e.printStackTrace();
}