android|http获取文件大小

URL url = new URL(downloadUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(5 * 1000);
conn.setRequestProperty("Accept-Language", Params.ACCEPT_LANGUAGE);
conn.setRequestProperty("Charset", Params.ChARSET);
conn.setRequestMethod("GET");
conn.setRequestProperty("Connetion", "Keep-Alive");
// 文件大小
int fileSize = conn.getContentLength();

    推荐阅读