无法在 Apache WorkbookFactory 上找到 close() 方法 [英] cant find close() method on Apache WorkbookFactory
问题描述
指南说完成后关闭工作簿.使用后应关闭工作簿"
the guide are saying to close workbook when done. "Workbook should be closed after use"
但我没有关闭方法来关闭它.
but i dont have a close method to close it.
怎么关闭?
Workbook wb = WorkbookFactory.create(tempFile);
wb.close();
我正在使用 Apache poi Maven,版本 3.9
i'm working with Apache poi Maven, version 3.9
The method close() is undefined for the type Workbook ... line 423 Java Problem
注1:为了正确释放资源,Workbook 使用后应关闭.
Note 1: that in order to properly release resources the Workbook should be closed after use.
注意 2:从 InputStream 加载比从文件加载需要更多内存
Note 2: also that loading from an InputStream requires more memory than loading from a File
我想使用一个文件而不是一个输入流,比如这个 说
i would like to use a file and not an input stream like this one sayes
推荐答案
在 Apache WorkbookFactory 上找不到 close() 方法
cant find close() method on Apache WorkbookFactory
您需要关闭工作簿
,而不是它的工厂.
You need to close the Workbook
, not its factory.
注意 1:为了正确释放资源,Workbook 使用后应关闭.
Note 1: that in order to properly release resources the Workbook should be closed after use.
正确.
注意 2:从 InputStream
加载比从 File
Note 2: also that loading from an
InputStream
requires more memory than loading from aFile
不真实,除非 InputStream
是 ByteArrayInputStream
.
Untrue, unless the InputStream
is a ByteArrayInputStream
.
这篇关于无法在 Apache WorkbookFactory 上找到 close() 方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!