java – 关闭DataInputStream还会关闭FileInputStream吗?
发布时间:2020-12-14 06:02:15 所属栏目:Java 来源:网络整理
导读:FileInputStream fstream = new FileInputStream(someFile.getPath());DataInputStream in = new DataInputStream(fstream); 如果我调用in.close(),它还会关闭fstream吗?我的代码给出了GC Exception,如下所示: java.lang.OutOfMemoryError:超出了GC开销限
FileInputStream fstream = new FileInputStream(someFile.getPath()); DataInputStream in = new DataInputStream(fstream); 如果我调用in.close(),它还会关闭fstream吗?我的代码给出了GC Exception,如下所示: java.lang.OutOfMemoryError:超出了GC开销限制 解决方法
是的,DataInputStream.close()也会关闭您的FileInputStream.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |