當前位置: 首頁>>代碼示例>>Java>>正文


Java JRLoader.getLocationInputStream方法代碼示例

本文整理匯總了Java中net.sf.jasperreports.engine.util.JRLoader.getLocationInputStream方法的典型用法代碼示例。如果您正苦於以下問題:Java JRLoader.getLocationInputStream方法的具體用法?Java JRLoader.getLocationInputStream怎麽用?Java JRLoader.getLocationInputStream使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.sf.jasperreports.engine.util.JRLoader的用法示例。


在下文中一共展示了JRLoader.getLocationInputStream方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fill

import net.sf.jasperreports.engine.util.JRLoader; //導入方法依賴的package包/類
/**
 *
 */
public void fill() throws JRException
{
	long start = System.currentTimeMillis();
	Map<String, Object> parameters = new HashMap<String, Object>();
	try
	{
		JRCsvDataSource xyds = new JRCsvDataSource(JRLoader.getLocationInputStream("data/xyDatasource.csv"), "UTF-8");
		xyds.setRecordDelimiter("\r\n");
		xyds.setUseFirstRowAsHeader(true);
		parameters.put("xyDatasource", xyds);
	}
	catch (Exception e)
	{
		throw new JRException(e);
	}
	JasperFillManager.fillReportToFile("build/reports/XYChart.jasper", new HashMap<String, Object>(parameters), new JREmptyDataSource());
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:22,代碼來源:XChartApp.java

示例2: getDataSource

import net.sf.jasperreports.engine.util.JRLoader; //導入方法依賴的package包/類
/**
	 *
	 */
	private static ExcelDataSource getDataSource() throws JRException
	{
		ExcelDataSource ds;
		
		try
		{
			String[] columnNames = new String[]{"city", "id", "name", "address", "state"};
			int[] columnIndexes = new int[]{0, 2, 3, 4, 5};
			ds = new ExcelDataSource(JRLoader.getLocationInputStream("data/XlsDataSource.data.xls"));
//			ds.setUseFirstRowAsHeader(true);
			ds.setColumnNames(columnNames, columnIndexes);
			
			//uncomment the below line to see how sheet selection works
//			ds.setSheetSelection("xlsdatasource2");
		}
		catch (Exception e)
		{
			throw new JRException(e);
		}
		
		return ds;
	}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:26,代碼來源:XlsDataSourceApp.java

示例3: copyScript

import net.sf.jasperreports.engine.util.JRLoader; //導入方法依賴的package包/類
protected File copyScript(String scriptLocation)
{
	String resourceName = getResourceName(scriptLocation);
	try
	{
		File file = File.createTempFile(TEMP_FILE_PREFIX, "_" + resourceName, tempFolder);
		file.deleteOnExit();//TODO lucianc leak
		
		if (log.isDebugEnabled())
		{
			log.debug("copying " + scriptLocation + " to " + file);
		}
	
		byte[] buf = new byte[COPY_BUFFER_SIZE];
		try (InputStream input = JRLoader.getLocationInputStream(scriptLocation);
				OutputStream output = new FileOutputStream(file))
		{
			int read = 0;
			while ((read = input.read(buf)) > 0)
			{
				output.write(buf, 0, read);
			}
		}
		
		return file;
	}
	catch (IOException | JRException e)
	{
		throw new JRRuntimeException(e);
	}
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:32,代碼來源:ScriptManager.java


注:本文中的net.sf.jasperreports.engine.util.JRLoader.getLocationInputStream方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。