/** * Returns requested ClassPathResource as InputStream object * * @return File requested at constructor call * @throws FileNotFoundException */ public InputStream getInputStream() throws FileNotFoundException { URL url = this.getUrl(); if (isJarURL(url)) { try { url = extractActualUrl(url); ZipFile zipFile = new ZipFile(url.getFile()); ZipEntry entry = zipFile.getEntry(this.resourceName); InputStream stream = zipFile.getInputStream(entry); return stream; } catch (Exception e) { throw new RuntimeException(e); } } else { File srcFile = this.getFile(); return new FileInputStream(srcFile); } } }
URL url = this.getUrl(); if (isJarURL(url)) { url = extractActualUrl(url); File file = File.createTempFile("canova_temp", "file"); file.deleteOnExit();
URL url = this.getUrl(); if (isJarURL(url)) { url = extractActualUrl(url); File file = File.createTempFile("canova_temp", "file"); file.deleteOnExit();
/** * Returns requested ClassPathResource as InputStream object * * @return File requested at constructor call * @throws FileNotFoundException */ public InputStream getInputStream() throws FileNotFoundException { URL url = this.getUrl(); if (isJarURL(url)) { try { url = extractActualUrl(url); ZipFile zipFile = new ZipFile(url.getFile()); ZipEntry entry = zipFile.getEntry(this.resourceName); InputStream stream = zipFile.getInputStream(entry); return stream; } catch (Exception e) { throw new RuntimeException(e); } } else { File srcFile = this.getFile(); return new FileInputStream(srcFile); } } }