/** * Reports whether the entry is valid, in the sense that the entry is * more recent than the archive itself. * @param entryName name of the entry to check * @return */ private boolean isEntryValid(final String entryName, final Logger logger) { return isEntryValid(getEntryFile(entryName), true, logger); }
/** * @return a @see java.io.InputStream for an existing entry in * the current abstract archive * @param name the entry name */ @Override public InputStream getEntry(String name) throws IOException { File input = getEntryFile(name); if (!input.exists() || input.isDirectory() || ! isEntryValid(input)) { // If name corresponds to directory, return null as it can not be opened return null; } FileInputStream fis = new FileInputStream(input); try { BufferedInputStream bis = new BufferedInputStream(fis); return bis; } catch (Throwable tx) { if (fis != null) { try { fis.close(); } catch (Throwable thr) { throw new IOException("Error closing FileInputStream after error opening BufferedInputStream for entry " + name, thr); } } throw new IOException("Error opening BufferedInputStream for entry " + name, tx); } }