2013-07-15 25 views
0

我試圖讀取OSGi包下的資源文件格式不同是我的代碼片段:閱讀從OSGi包文件返回輸入流

InputStream in; 
URL url; 

BundleContext bc = FrameworkUtil.getBundle(ReportUtil.class).getBundleContext(); // ReportUtil is the name of the class 

url = bc.getBundle().getResource("sample_report.jrxml"); // URL is returned as /sample_report.jrxml 
InputStream dataStream ; 
dataStream= url.openStream();// Input Stream is  [email protected] 

什麼是java.util.zip的意義。ZipFile $ ZipFileInflaterInputStream?

我需要使用碧玉編譯報告中的數據流,這需要輸入爲InputStream的,有沒有java.util.zip.ZipFile中的$ ZipFileInflaterInputStream轉換成一個InputStream

回答

0

它已經is an InputStream的方式 - 請參閱類層次結構。只需將它傳遞給Jasper Reports即可。

+0

我正在嘗試,例如, JasperCompileManager.compileReport(dataStream)它顯示了一個很大的異常跟蹤,所以我認爲這兩種格式之間存在兼容性不匹配 – KAPILP