各位大侠,我想用Http方式获取网络上一张图片HttpURLConnection httpConn;
try {
URL url=new URL(path);
httpConn = (HttpURLConnection)url.openConnection();
httpConn.setConnectTimeout(5*1000);
httpConn.setRequestMethod("get");
int code=httpConn.getResponseCode();
Log.d(tag,"Responsecode is "+code);
InputStream ipStream=httpConn.getInputStream();
int len=-1;
ByteArrayOutputStream otStream=new ByteArrayOutputStream();
while((len=ipStream.read(bt))!=-1){
  otStream.write(bt, 0, len);
}
ipStream.close();
otStream.close();
return otStream.toByteArray();

} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
Log.d(tag, "IOException.."+e1.toString());
}运行到setRequestMethod方法时弹出异常,我不知道如何找原因,请大侠们指点。