/** delete an entry in the archive * @param name the entry name * @return true if the entry was successfully deleted * */ public boolean deleteEntry(String name) { return deleteEntry(name, true); }
/** * @returns an @see java.io.OutputStream for a new entry in this * current abstract archive. * @param name the entry name */ @Override public OutputStream putNextEntry(String name) throws java.io.IOException { name = name.replace('/', File.separatorChar); File newFile = new File(archive, name); if (newFile.exists()) { if (!deleteEntry(name, false /* isLogging */)) { logger.log(Level.FINE, "Could not delete file {0} in FileArchive {1} during putNextEntry; continuing", new Object[]{name, uri.toASCIIString()}); } } // if the entry name contains directory structure, we need // to create those directories first. if (name.lastIndexOf(File.separatorChar)!=-1) { String dirs = name.substring(0, name.lastIndexOf(File.separatorChar)); (new File(archive, dirs)).mkdirs(); } staleFileManager().recordValidEntry(newFile); os = new BufferedOutputStream(new FileOutputStream(newFile)); return os; }