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

The following examples show how to use net.sf.jasperreports.engine.util.JRLoader#loadBytesFromResource() . 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: FileBufferedZip.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void addEntry(String name, String resource)
{
	byte[] bytes = null;

	try
	{
		bytes = JRLoader.loadBytesFromResource(resource);
	}
	catch (JRException e)
	{
		throw new JRRuntimeException(e);
	}
	
	addEntry(new FileBufferedZipEntry(name, bytes));
}
 
Example 2
Source File: CastorUtil.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
private void loadMapping(Mapping mapping, String mappingFile)
{
	try
	{
		byte[] mappingFileData = JRLoader.loadBytesFromResource(mappingFile);
		InputSource mappingSource = new InputSource(new ByteArrayInputStream(mappingFileData));

		mapping.loadMapping(mappingSource);
	}
	catch (JRException e)
	{
		throw new JRRuntimeException(e);
	}
}
 
Example 3
Source File: Report.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void readReferenceDigest() throws JRException, NoSuchAlgorithmException
{
	byte[] jrpxmlBytes = JRLoader.loadBytesFromResource(jrpxml);
	MessageDigest digest = MessageDigest.getInstance("SHA-1");
	digest.update(jrpxmlBytes);
	referenceJRPXMLDigest = toDigestString(digest);
	log.debug("Reference report digest for " + jrpxml + " is " + referenceJRPXMLDigest);
}