Package java.util.zip

Class Zip64


  • public class Zip64
    extends Object
    • Field Detail

      • MAX_ZIP_ENTRY_AND_ARCHIVE_SIZE

        public static final long MAX_ZIP_ENTRY_AND_ARCHIVE_SIZE
        The maximum supported entry / archive size for standard (non zip64) entries and archives.
        See Also:
        Constant Field Values
    • Method Detail

      • parseZip64EocdRecordLocator

        public static long parseZip64EocdRecordLocator​(RandomAccessFile raf,
                                                       long eocdOffset)
                                                throws IOException
        Parses the zip64 end of central directory record locator. The locator must be placed immediately before the end of central directory (eocd) record starting at eocdOffset. The position of the file cursor for raf after a call to this method is undefined an callers must reposition it after each call to this method.
        Throws:
        IOException
      • parseZip64EocdRecord

        public static java.util.zip.ZipFile.EocdRecord parseZip64EocdRecord​(RandomAccessFile raf,
                                                                            long eocdRecordOffset,
                                                                            int commentLength)
                                                                     throws IOException
        Throws:
        IOException
      • parseZip64ExtendedInfo

        public static boolean parseZip64ExtendedInfo​(ZipEntry ze,
                                                     boolean fromCentralDirectory)
                                              throws ZipException
        Parse the zip64 extended info record from the extras present in ze. If fromCentralDirectory is true, we assume we're parsing a central directory record. We assume a local file header otherwise. The difference between the two is that a central directory entry is required to be complete, whereas a local file header isn't. This is due to the presence of an optional data descriptor after the file content.
        Returns:
        true iff. a zip64 extended info record was found.
        Throws:
        ZipException
      • insertZip64ExtendedInfoToExtras

        public static void insertZip64ExtendedInfoToExtras​(ZipEntry ze)
                                                    throws ZipException
        Appends a zip64 extended info record to the extras contained in ze. If ze contains no extras, a new extras array is created.
        Throws:
        ZipException
      • refreshZip64ExtendedInfo

        public static void refreshZip64ExtendedInfo​(ZipEntry ze)
        Copy the size, compressed size and local header offset fields from ze to inside ze's extended info record. This is additional step is necessary when we could calculate the correct sizes only after writing out the entry. In this case, the local file header would not contain real sizes, and they would be present in the data descriptor and the central directory only. We choose the simplest strategy of always writing out the size, compressedSize and local header offset in all our Zip64 Extended info records.