java image 内存不足,内存不足错误 - 超出GC开销限制

我正在使用java中的XHTML转换器将DOCX文件转换为HTML文件。即我们正在将HTML文件下载到临时路径,然后我在浏览器中加载该HTML文件。但转换之前它给出了一个错误:内存不足错误 - 超出GC开销限制

Error 404 not found

(浏览器)和

java.lang.OutOfMemoryError: GC overhead limit exceeded

(控制台)。

我在下面的代码中的“XWPFDocument document = new XWPFDocument(in);”行中出现错误。

String root = finalDestinationPath;

int lastIndex = sDocPath.lastIndexOf(File.separator);

String sFileName = sDocPath.substring(lastIndex + 1, sDocPath.length());

String fileNameWithOutExt = FilenameUtils.removeExtension(sFileName);

String fileOutName = root + File.separator + fileNameWithOutExt + ".html";

InputStream in = new FileInputStream(new File(sDocPath));

XWPFDocument document = new XWPFDocument(in);

XHTMLOptions options = XHTMLOptions.create();// .indent(4);

String sLocalSystemImagePath = finalDestinationPath + File.separator+"images"+File.separator;

File imageFolder = new File(sLocalSystemImagePath);

options.setExtractor(new FileImageExtractor(imageFolder));

// URI resolver

String localHostImagePath = downloadImagePath + File.separator+"images"+File.separator;

FileResolver fileURIResolver = new FileResolver(new File(localHostImagePath));

options.URIResolver(fileURIResolver);

out = new FileOutputStream(new File(fileOutName));

XHTMLConverter.getInstance().convert(document, out, options);

2015-03-13

Rashmi

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值