当前位置: 首页>>代码示例>>Java>>正文


Java JRLoader.loadBytes方法代码示例

本文整理汇总了Java中net.sf.jasperreports.engine.util.JRLoader.loadBytes方法的典型用法代码示例。如果您正苦于以下问题:Java JRLoader.loadBytes方法的具体用法?Java JRLoader.loadBytes怎么用?Java JRLoader.loadBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.jasperreports.engine.util.JRLoader的用法示例。


在下文中一共展示了JRLoader.loadBytes方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRenderable

import net.sf.jasperreports.engine.util.JRLoader; //导入方法依赖的package包/类
/**
 *
 */
public Renderable getRenderable(InputStream is, OnErrorTypeEnum onErrorType) throws JRException
{
	Renderable result;
	try
	{
		result = new JRImageRenderer(JRLoader.loadBytes(is));
	}
	catch (Exception e)
	{
		result = handleImageError(e, onErrorType); 
		
		if (log.isDebugEnabled())
		{
			log.debug("handled image error with type " + onErrorType, e);
		}
	}
	return result;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:22,代码来源:RenderableUtil.java

示例2: getRenderable

import net.sf.jasperreports.engine.util.JRLoader; //导入方法依赖的package包/类
/**
 *
 */
public Renderable getRenderable(InputStream is, OnErrorTypeEnum onErrorType) throws JRException
{
	byte[] data = null;
	try
	{
		data = JRLoader.loadBytes(is);
	}
	catch (Exception e)
	{
		if (log.isDebugEnabled())
		{
			log.debug("handled image error with type " + onErrorType, e);
		}

		return handleImageError(e, onErrorType); 
	}
	return SimpleDataRenderer.getInstance(data);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:22,代码来源:RendererUtil.java

示例3: getCoords

import net.sf.jasperreports.engine.util.JRLoader; //导入方法依赖的package包/类
private Float[] getCoords(String address) throws JRException {
	Float[] coords = null;
	if(address != null) {
		try {
			String urlStr = MapFillComponent.PLACE_URL_PREFIX + URLEncoder.encode(address, MapFillComponent.DEFAULT_ENCODING) + MapFillComponent.PLACE_URL_SUFFIX;
			URL url = new URL(urlStr);
			byte[] response = JRLoader.loadBytes(url);
			Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(response));
			Node statusNode = (Node) new DOMXPath(MapFillComponent.STATUS_NODE).selectSingleNode(document);
			String status = statusNode.getTextContent();
			if(MapFillComponent.STATUS_OK.equals(status)) {
				coords = new Float[2];
				Node latNode = (Node) new DOMXPath(MapFillComponent.LATITUDE_NODE).selectSingleNode(document);
				coords[0] = Float.valueOf(latNode.getTextContent());
				Node lngNode = (Node) new DOMXPath(MapFillComponent.LONGITUDE_NODE).selectSingleNode(document);
				coords[1] = Float.valueOf(lngNode.getTextContent());
			} else {
				throw 
					new JRException(
						MapFillComponent.EXCEPTION_MESSAGE_KEY_ADDRESS_REQUEST_FAILED,  
						new Object[]{status}
						);
			}
		} catch (Exception e) {
			throw new JRException(e);
		}
	}
	return coords;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:30,代码来源:FillPlaceItem.java

示例4: getCoords

import net.sf.jasperreports.engine.util.JRLoader; //导入方法依赖的package包/类
private Float[] getCoords(String address) throws JRException {
	Float[] coords = null;
	if(address != null) {
		try {
			String urlStr = PLACE_URL_PREFIX + URLEncoder.encode(address, DEFAULT_ENCODING) + PLACE_URL_SUFFIX;
			URL url = new URL(urlStr);
			byte[] response = JRLoader.loadBytes(url);
			Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(response));
			Node statusNode = (Node) new DOMXPath(STATUS_NODE).selectSingleNode(document);
			String status = statusNode.getTextContent();
			if(STATUS_OK.equals(status)) {
				coords = new Float[2];
				Node latNode = (Node) new DOMXPath(LATITUDE_NODE).selectSingleNode(document);
				coords[0] = Float.valueOf(latNode.getTextContent());
				Node lngNode = (Node) new DOMXPath(LONGITUDE_NODE).selectSingleNode(document);
				coords[1] = Float.valueOf(lngNode.getTextContent());
			} else {
				throw 
					new JRException(
						EXCEPTION_MESSAGE_KEY_ADDRESS_REQUEST_FAILED,  
						new Object[]{status} 
						);
			}
		} catch (Exception e) {
			throw new JRException(e);
		}
	}
	return coords;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:30,代码来源:MapFillComponent.java

示例5: resolveEntity

import net.sf.jasperreports.engine.util.JRLoader; //导入方法依赖的package包/类
@Override
public InputSource resolveEntity(
	String pubId,
	String systemId
	)
{
	InputSource inputSource = null;

	if (systemId != null)
	{
		URL resourceURL = internalEntityResources.get(systemId);
		
		if (resourceURL == null)
		{
			if (entityURLs.contains(systemId) || loadUnknownEntities)
			{
				if (log.isDebugEnabled())
				{
					log.debug("loading entity " + systemId);
				}
				
				//FIXME load from resource URLs?
				inputSource = new InputSource(systemId);
			}
			else
			{
				throw new JRRuntimeException(EXCEPTION_MESSAGE_UNKOWN_ENTITY_NOT_LOADING, 
						new Object[]{systemId});
			}
		}
		else
		{
			try
			{
				// load the data into the memory
				byte[] resourceData = JRLoader.loadBytes(resourceURL);
				InputStream memoryStream = new ByteArrayInputStream(resourceData);
				inputSource = new InputSource(memoryStream);
			}
			catch (JRException e)
			{
				throw 
					new JRRuntimeException(
						EXCEPTION_MESSAGE_KEY_ENTITY_LOADING_ERROR,
						new Object[]{systemId},
						e);
			}
		}
	}

	return inputSource;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:53,代码来源:JRXmlDigester.java

示例6: compileUnits

import net.sf.jasperreports.engine.util.JRLoader; //导入方法依赖的package包/类
@Override
protected String compileUnits(JRCompilationUnit[] units, String classpath, File tempDirFile) throws JRException
{
	File[] sources = new File[units.length];
	for (int i = 0; i < sources.length; i++)
	{
		sources[i] = units[i].getSourceFile();
	}
	
	File[] classFiles = new File[units.length];
	for (int i = 0; i < classFiles.length; i++)
	{
		classFiles[i] = new File(tempDirFile, units[i].getName() + ".class");
	}
	
	try
	{
		String errors = compileClasses(sources, classpath);

		if (errors == null)
		{
			for (int i = 0; i < units.length; i++)
			{
				byte[] classBytes = JRLoader.loadBytes(classFiles[i]);
				units[i].setCompileData(classBytes);
			}
		}
		
		return errors;
	}
	finally
	{
		for (int i = 0; i < classFiles.length; i++)
		{
			if (classFiles[i].exists())
			{
				classFiles[i].delete();
			}
		}
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:42,代码来源:JRAbstractClassCompiler.java

示例7: getInstance

import net.sf.jasperreports.engine.util.JRLoader; //导入方法依赖的package包/类
/**
 * Creates a SVG renderer from a data stream.
 *
 * <p>
 * Note: the data stream is exhausted, but not closed.
 * </p>
 *
 * @param svgDataStream the SVG binary data stream
 * @return a SVG renderer
 * @throws JRException
 */
public static BatikRenderer getInstance(InputStream svgDataStream) throws JRException
{
	byte[] data = JRLoader.loadBytes(svgDataStream);
	return new BatikRenderer(data, null);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:17,代码来源:BatikRenderer.java


注:本文中的net.sf.jasperreports.engine.util.JRLoader.loadBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。