Android에서 html (html 만) 웹 페이지의 파일 크기를 어떻게 계산할 수 있습니까?
나는 이것을 시도했다 :
HttpGet request = new HttpGet(fullUrl);
HttpResponse response = new DefaultHttpClient().execute(request);
HttpEntity entity = response.getEntity();
InputStream input = entity.getContent();
int size = input.available();
그러나 available ()은 항상 0을 반환합니다.
HttpResponse response = client.execute(httpPost);
String content = EntityUtils.toString(response.getEntity());
byte[] bytes = content.getBytes("UTF8");
최신 정보
URL url = new URL("http://server.com/file.mp3");
URLConnection urlConnection = url.openConnection();
urlConnection.connect();
int file_size = urlConnection.getContentLength();
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다