本文介绍了我必须关闭FileInputStream吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Test Automation的培训生.我正在使用Eclipse创建Junit代码并使用Eclipse运行.在这种情况下,我使用FileInputStream函数从excel工作表中检索数据.
I am working as a trainee in Test Automation.I am working with creating Junit code with Eclipse and run using Eclipse.In that I am retriving the datas from excel sheet using FileInputStream function.
FileInputStream fi=new FileInputStream("c:\\search.xls");
Workbook w=Workbook.getWorkbook(fi);
Sheet s=w.getSheet(0);
是否需要关闭Inputstream函数?如果可以,请指导我进行一些编码.
Is it necessary to close the Inputstream function? If it so please guide me with some codings.
推荐答案
是的,如果要释放系统资源,则需要close
输入流.
Yes, you need to close
the inputstream if you want your system resources released back.
FileInputStream.close()
是您所需要的.
FileInputStream.close()
is what you need.
这篇关于我必须关闭FileInputStream吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!