如何在java中使用JRSwapFileVirtualizer进行jasper报告 [英] how to use JRSwapFileVirtualizer for jasper reports in java

查看:122
本文介绍了如何在java中使用JRSwapFileVirtualizer进行jasper报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在java中使用JRSwapFileVirtualizer for jasper报告,这是我使用的代码..

how to use JRSwapFileVirtualizer for jasper reports in java, this is the code which i use..

JRSwapFileVirtualizer virtualizer = null;
virtualizer = new JRSwapFileVirtualizer(10000, new JRSwapFile("F://", 1000, 1000), false);
param.put(JRParameter.REPORT_VIRTUALIZER, virtualizer);

xmlDataSource = new JRXmlDataSource(reportFile,"/table/tr");
jasperPrint = JasperFillManager.fillReport(jasperpath, param, xmlDataSource);

我仍然收到堆空间错误(OutOfMemeoryException),并且创建的文件为空。

still i get the heap space error(OutOfMemeoryException), and the file which gets created is empty.

推荐答案

JRSwapFileVirtualizer的构造函数的第一个参数是之前将存储在主存储器(RAM)中的最大报告页数报告的各个部分存储在虚拟内存(磁盘)中。因此,如果您的报告页面大小不超过10000页,那么您将无法将它们存储在虚拟内存中,即使您编写了虚拟器代码,也不会真正使用此美容。

First parameter of the constructor of the JRSwapFileVirtualizer is the maximum number of report pages that will be stored in primary memory (RAM) before sections of the report are stored in virtual memory (disk). So if your report page size does not exceed 10000 page then you are not able to store them in virtual memory and even though you write the virtualizer code you are not actually using this beauty.

尝试类似的事情,

JRSwapFileVirtualizer virtualizer = null; 
virtualizer = new JRSwapFileVirtualizer(3, new JRSwapFile("F://", 2048, 1024), false); 
param.put(JRParameter.REPORT_VIRTUALIZER, virtualizer);

希望它有效: - )

干杯......

这篇关于如何在java中使用JRSwapFileVirtualizer进行jasper报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆