简体   繁体   English

如何在Java中将JRSwapFileVirtualizer用于jasper报告

[英]how to use JRSwapFileVirtualizer for jasper reports in java

how to use JRSwapFileVirtualizer for jasper reports in java, this is the code which i use.. 如何在Java中将JRSwapFileVirtualizer用于jasper报告,这是我使用的代码。

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);

still i get the heap space error(OutOfMemeoryException), and the file which gets created is empty. 仍然我得到堆空间错误(OutOfMemeoryException),并且创建的文件为空。

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). JRSwapFileVirtualizer的构造函数的第一个参数是在将报告的各个部分存储在虚拟内存(磁盘)中之前将存储在主内存(RAM)中的最大报告页数。 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. 因此,如果您的报告页面大小不超过10000页,那么您将无法将它们存储在虚拟内存中,即使您编写了虚拟程序代码,也实际上并未使用此功能。

Try something like, 尝试类似的东西,

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

Hope it works :-) 希望它能工作:-)

cheers... 干杯...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM