/** * Returns the content of the archive as <code>JarInputStream</code>. * * @return The input stream * @throws IOException If an exception occurred reading the archive */ protected final JarInputStream getContentAsStream() throws IOException { if (this.content != null) { return new JarInputStream(new ByteArrayInputStream(this.content)); } return new JarInputStream(getFileHandler().getInputStream(this.sourceFile)); }
/** * Returns the content of the archive as <code>JarInputStream</code>. * * @return The input stream * @throws IOException If an exception occurred reading the archive */ protected final JarInputStream getContentAsStream() throws IOException { if (this.content != null) { return new JarInputStream(new ByteArrayInputStream(this.content)); } return new JarInputStream(getFileHandler().getInputStream(this.sourceFile)); }
try (InputStream file = this.fileHandler.getInputStream(this.filePath))
try (InputStream file = this.fileHandler.getInputStream(this.filePath))
try (InputStream is = getFileHandler().getInputStream(file))
fileHandler.getInputStream(entry.getValue()));
fileHandler.getInputStream(entry.getValue()));
try (InputStream is = getFileHandler().getInputStream(file))
try (JarInputStream jarStream = new JarInputStream(getFileHandler().getInputStream( getFileHandler().append(getHome(), "lib/resin.jar"))))
try (JarInputStream jarStream = new JarInputStream(getFileHandler().getInputStream( getFileHandler().append(getHome(), "lib/resin.jar"))))
/** * read the specified file into a Document. * * @param sourceFile file to read * @return Document corresponding with sourceFile */ public Document loadXmlFromFile(String sourceFile) { if (!getFileHandler().exists(sourceFile)) { throw new CargoException("Cannot find file: " + sourceFile); } if (getFileHandler().isDirectory(sourceFile)) { throw new CargoException("The destination is a directory: " + sourceFile); } try (InputStream is = getFileHandler().getInputStream(sourceFile)) { return this.builder.parse(is); } catch (Exception e) { throw new CargoException("Cannot parse XML file " + sourceFile, e); } }
/** * read the specified file into a Document. * * @param sourceFile file to read * @return Document corresponding with sourceFile */ public Document loadXmlFromFile(String sourceFile) { if (!getFileHandler().exists(sourceFile)) { throw new CargoException("Cannot find file: " + sourceFile); } if (getFileHandler().isDirectory(sourceFile)) { throw new CargoException("The destination is a directory: " + sourceFile); } try (InputStream is = getFileHandler().getInputStream(sourceFile)) { return this.builder.parse(is); } catch (Exception e) { throw new CargoException("Cannot parse XML file " + sourceFile, e); } }