/** * {@inheritDoc} * @throws Zip64RequiredException if the archive's size exceeds 4 * GByte or there are more than 65535 entries inside the archive * and {@link #setUseZip64} is {@link Zip64Mode#Never}. */ public void finish() throws IOException { if (finished) { throw new IOException("This archive has already been finished"); } if (entry != null) { closeEntry(); } cdOffset = written; writeCentralDirectoryInChunks(); cdLength = written - cdOffset; writeZip64CentralDirectory(); writeCentralDirectoryEnd(); offsets.clear(); entries.clear(); def.end(); finished = true; }