Java – will closing datainputstream also close FileInputStream?

FileInputStream fstream = new FileInputStream(someFile.getPath());
FileInputStream fstream = new FileInputStream(someFile.getPath());
DataInputStream in = new DataInputStream(fstream);

If I call in Close(), will it also close fstream? My code gives GC exception as follows:

java. Lang. outofmemoryerror: GC overhead limit exceeded

Solution

Yes, datainputstream Close() will also close your FileInputStream

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>