/** * Searches for either the "Zip64 end of central directory * locator" or the "End of central dir record", parses * it and positions the stream at the first central directory * record. */ private void positionAtCentralDirectory() throws IOException { positionAtEndOfCentralDirectoryRecord(); boolean found = false; final boolean searchedForZip64EOCD = archive.position() > ZIP64_EOCDL_LENGTH; if (searchedForZip64EOCD) { archive.position(archive.position() - ZIP64_EOCDL_LENGTH); wordBbuf.rewind(); IOUtils.readFully(archive, wordBbuf); found = Arrays.equals(ZipArchiveOutputStream.ZIP64_EOCD_LOC_SIG, wordBuf); } if (!found) { // not a ZIP64 archive if (searchedForZip64EOCD) { skipBytes(ZIP64_EOCDL_LENGTH - WORD); } positionAtCentralDirectory32(); } else { positionAtCentralDirectory64(); } }
/** * Searches for either the "Zip64 end of central directory * locator" or the "End of central dir record", parses * it and positions the stream at the first central directory * record. */ private void positionAtCentralDirectory() throws IOException { positionAtEndOfCentralDirectoryRecord(); boolean found = false; final boolean searchedForZip64EOCD = archive.position() > ZIP64_EOCDL_LENGTH; if (searchedForZip64EOCD) { archive.position(archive.position() - ZIP64_EOCDL_LENGTH); wordBbuf.rewind(); IOUtils.readFully(archive, wordBbuf); found = Arrays.equals(ZipArchiveOutputStream.ZIP64_EOCD_LOC_SIG, wordBuf); } if (!found) { // not a ZIP64 archive if (searchedForZip64EOCD) { skipBytes(ZIP64_EOCDL_LENGTH - WORD); } positionAtCentralDirectory32(); } else { positionAtCentralDirectory64(); } }