【发布时间】:2012-08-30 15:33:47
【问题描述】:
在关闭流之前是否需要读取/跳过 InputStream?如果未读取流,这是否会导致未来连接出现任何问题(使用保持活动状态)?使用 Oracle JVM。
InputStream is = null;
try {
URL url = new URL("http://example.com/executeTrigger?id=523");
is = url.openStream();
} catch (Exception ex) {
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
}
}
}
上述是否有效,或者我应该在执行url.openStream()之后直接调用is.skip(Long.MAX_VALUE)?
【问题讨论】:
-
在你提供的上下文中,不,我不应该这样认为。
标签: java url inputstream