當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。