Java Code Examples for net.sf.jasperreports.engine.util.JRLoader#getResourceInputStream()

The following examples show how to use net.sf.jasperreports.engine.util.JRLoader#getResourceInputStream() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractTest.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * This method is used for compiling subreports.
 */
public JasperReport compileReport(String jrxmlFileName) throws JRException, IOException
{
	JasperReport jasperReport = null;
	
	InputStream jrxmlInput = JRLoader.getResourceInputStream(jrxmlFileName);

	if (jrxmlInput != null)
	{
		JasperDesign design;
		try
		{
			design = JRXmlLoader.load(jrxmlInput);
		}
		finally
		{
			jrxmlInput.close();
		}
		jasperReport = JasperCompileManager.compileReport(design);
	}
	
	return jasperReport;
}
 
Example 2
Source File: Report.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
public JasperReport compileReport() throws JRException, IOException
{
	InputStream jrxmlInput = JRLoader.getResourceInputStream(jrxml);
	JasperDesign design;
	try
	{
		design = JRXmlLoader.load(jrxmlInput);
	}
	finally
	{
		jrxmlInput.close();
	}
	
	report = JasperCompileManager.compileReport(design);
	
	//TODO do we need this here?
	fillManager = JasperFillManager.getInstance(jasperReportsContext);
	
	return report;
}