所以我有这个的FileInputStream所需创建ZipInputStream,我想知道,如果的FileInputStream关闭会发生什么情况ZipInputStream。请看下面的代码:检查FileInputStream是否关闭的最佳方法是什么?
public void Foo(File zip) throws ZipException{
ZipInputStream zis;
FileInputStream fis = new FileInputStream(zip);
try{
zis = new ZipInputStream(fis);
} catch (FileNotFoundException ex) {
throw new ZipException("Error opening ZIP file for reading", ex);
} finally {
if(fis != null){ fis.close();
}
}
是否ZIS remais打开? ZipInputStream对象会发生什么?有什么方法可以测试这个吗?
'zis'保持打开..你必须关闭它明确 –
有没有办法来测试? –