当我只使用HttpURLConnection.getErrorStream()时,我在HttpURLConnection.getErrorStream()之前使用HttpURLConnection.getResponseCode()时无法得到errstream.But,那么我可以得到errorstream。 像这样,我可以得到错误的声音:
if(urlconn.getResponseCode()>=400){
is = urlconn.getErrorStream();
System.out.println("error!!!");
}else{
is=urlconn.getInputStream();
}
像这样,我无法得到错误,'是'是空的:
is = urlconn.getErrorStream();