HttpUrlConnection 连接成功和连接失败如何获取返回的数据 返回成功(200状态码) 直接获取InputStream,代码如下: InputStream inputStream = connection.getInputStream(); 返回失败(400Bad Request) 获取ErrorStream InputStream inputStream = connection.getErrorStream();