请问为什么doc.saveToStream使用完之后内存没有释放
Document doc = new Document();
InputStream inputStream = null;
ByteArrayOutputStream htmlStream = new ByteArrayOutputStream();
try {
inputStream = file.getInputStream();
doc.loadFromStream(inputStream, FileFormat.Docx);
doc.getHtmlExportOptions().setImageEmbedded(true);
doc.getHtmlExportOptions().setCssStyleSheetType(CssStyleSheetType.Internal);
doc.getHtmlExportOptions().hasHeadersFooters(false);
doc.saveToStream(htmlStream, FileFormat.Html);
String htmlStreamStr = htmlStream.toString();
return htmlStreamStr;
} catch (Exception e) {
log.error("word文件转html 异常", e);
} finally {
try {
inputStream.close();
htmlStream.close();
doc.dispose();
} catch (Exception e) {
log.error("word文件转html 关闭流异常", e);
}
}