For very large reports, Jasper supports the REPORT_VIRTUALIZER report parameter to allow for better management of memory, including caching report pages to disk with JRFileVirtualizer. This allows reports to be run and exported to different formats with a very small memory footprint compared to the size of the report.
Report output may also be saved with JRSaver.saveObject() in the form of a serlialized instance of JasperPrint, typically with the .jrprint extension. Under normal circumstances, this allows flexibility in output rendering by delaying the choice of export format until the exported output is required. For instance, a report output might be serialized into a .jrprint file and retained in a database, and later exported to CSV or PDF, depending on user preference.
However, the JRLoader.loadObject() method (as called by the various JRExporter classes) deserializes the JasperPrint object naively, and does not allow for the "re-virtualization" of the object to preserve memory. Therefore, after the JasperPrint object has been serialized and released for garbage collection, it may be impossible to reload or export the report to another format.
Feature request: provide an option both within the JRLoader.loadObject() methods, and the JRExportParameter map, to allow for virtualization of reports being deserialized from .jrprint files.
Recommended Comments