我正在尝试使用API 23作为我的编译SDK版本在Android Studio项目中使用HttpURLConnection
。我一直很难排除故障,直到我打开它来查看源代码。通过一些方法,它们似乎被剔除或不完整。例如,对于方法HttpURLConnection.getErrorStream()
,我看到:
/**
* Returns an input stream from the server in the case of an error such as
* the requested file has not been found on the remote server. This stream
* can be used to read the data the server will send back.
*
* @return the error input stream returned by the server.
*/
public InputStream getErrorStream() {
return null;
}
还有其他一些方法似乎没有做到他们应该做的事情。这是对某个地方记录的API的更改吗?我服用疯子吗?
非常感谢任何帮助。