code: public ReportWriter getReportWriter(final JasperPrint _jasperPrint, final String _format, final Map<JRExporterParameter,Object> _parameters) {
          final JRExporter exporter = FormatInfoRegistry.getInstance().getExporter(_format);
          exporter.setParameters(_parameters);
  
          if (_jasperPrint.getPages().size() > PAGES_THRESHHOLD) {
              return new FileReportWriter(_jasperPrint, exporter);
          } else {
              return new MemoryReportWriter(_jasperPrint, exporter);
          }
      }
docs: Returns a ReportWriter that which will use memory or a file depending on the parameter PAGES_THRESHOLD
  @param _jasperPrint
  @param _format
  @param _parameters
  @return