public void finish() throws IOException { // Finish the entire ZIP stream, if any. if (currentJarOutputStream != null) { // Close the previous ZIP entry, if any. closeEntry(); // Finish the entire ZIP stream. currentJarOutputStream.finish(); currentJarOutputStream = null; currentParentOutputStream = null; jarEntryNames.clear(); } }
public boolean createDirectory(DataEntry dataEntry) throws IOException { //Make sure we can start with a new entry. if (!prepareEntry(dataEntry)) { return false; } // Close the previous ZIP entry, if any. closeEntry(); // Get the directory entry name. String name = dataEntry.getName() + ClassConstants.INTERNAL_PACKAGE_SEPARATOR; // We have to check if the name is already used, because // ZipOutputStream doesn't handle this case properly (it throws // an exception which can be caught, but the ZipDataEntry is // remembered anyway). if (jarEntryNames.add(name)) { // Create a new directory entry. currentJarOutputStream.putNextEntry(new ZipEntry(name)); currentJarOutputStream.closeEntry(); } // Clear the finisher. currentFinisher = null; currentDataEntry = null; return true; }