同样的代码。我在java本身的main里面执行的时候可以获得文件的长度,可是在android的junit test里面时却是-1;求解释!String path="http://mirrors.ustc.edu.cn/eclipse/technology/epp/downloads/release/indigo/SR1/eclipse-jee-indigo-SR1-win32.zip";
URL url=new URL(path);
HttpURLConnection conn;
conn=(HttpURLConnection) url.openConnection();
//conn.setRequestProperty("Charset", "UTF-8");
conn.setRequestMethod("GET");
conn.setConnectTimeout(6*1000);

int fileSize=conn.getContentLength();