/**
* 获取网络文件大小
*/
private static String getFileLength(String downloadUrl) throws IOException {
if(downloadUrl == null || "".equals(downloadUrl)){
return "0M ";
}
URL url = new URL(downloadUrl);
HttpURLConnection conn = null;
try {
conn = (HttpURLConnection) url.openConnection();
return (double) Math.round(((double) conn.getContentLength()/1024/1024)* 100) / 100+"M";
} catch (IOException e) {
return "0M";
} finally {
conn.disconnect();
}
}