我正在创建一个用于下载项目的类。我正在使用以下方法连接和检索下载信息:
public mDownload(String url) throws MalformedURLException {
this.url = new URL(url);
}
private void connect() throws IOException {
connection = url.openConnection();
date = connection.getDate();
--> expiration = connection.getExpiration();
length = connection.getContentLength();
lastModified = connection.getLastModified();
}
但我有一些关于-->
线路强制崩溃的报告:
java.lang.IllegalStateException: getInputStream() is not available. Is this a reentrant call?
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:524)
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHeaderField(HttpURLConnectionImpl.java:464)
at java.net.URLConnection.getHeaderFieldDate(URLConnection.java:548)
at java.net.HttpURLConnection.getHeaderFieldDate(HttpURLConnection.java:702)
at java.net.URLConnection.getExpiration(URLConnection.java:426)
为什么会发生此错误,我该如何避免?谢谢!