Class LogicalZipFile


  • public class LogicalZipFile
    extends ZipFileSlice
    A logical zipfile, which represents a zipfile contained within a ZipFileSlice of a PhysicalZipFile.
    • Field Detail

      • entries

        public java.util.List<FastZipEntry> entries
        The zipfile entries.
      • isMultiReleaseJar

        private boolean isMultiReleaseJar
        If true, this is a multi-release jar.
      • classpathRoots

        java.util.Set<java.lang.String> classpathRoots
        A set of classpath roots found in the classpath for this zipfile.
      • classPathManifestEntryValue

        public java.lang.String classPathManifestEntryValue
        The value of the "Class-Path" manifest entry, if present in the manifest, else null.
      • bundleClassPathManifestEntryValue

        public java.lang.String bundleClassPathManifestEntryValue
        The value of the "Bundle-ClassPath" manifest entry, if present in the manifest, else null.
      • addExportsManifestEntryValue

        public java.lang.String addExportsManifestEntryValue
        The value of the "Add-Exports" manifest entry, if present in the manifest, else null.
      • addOpensManifestEntryValue

        public java.lang.String addOpensManifestEntryValue
        The value of the "Add-Opens" manifest entry, if present in the manifest, else null.
      • automaticModuleNameManifestEntryValue

        public java.lang.String automaticModuleNameManifestEntryValue
        The value of the "Automatic-Module-Name" manifest entry, if present in the manifest, else null.
      • isJREJar

        public boolean isJREJar
        If true, this is a JRE jar.
      • enableMultiReleaseVersions

        private final boolean enableMultiReleaseVersions
        If true, multi-release versions should not be stripped in resource names.
      • META_INF_PATH_PREFIX

        static final java.lang.String META_INF_PATH_PREFIX
        "META_INF/".
        See Also:
        Constant Field Values
      • MANIFEST_PATH

        private static final java.lang.String MANIFEST_PATH
        "META-INF/MANIFEST.MF".
        See Also:
        Constant Field Values
      • MULTI_RELEASE_PATH_PREFIX

        public static final java.lang.String MULTI_RELEASE_PATH_PREFIX
        "META-INF/versions/".
        See Also:
        Constant Field Values
      • IMPLEMENTATION_TITLE_KEY

        private static final byte[] IMPLEMENTATION_TITLE_KEY
        The "Implementation-Title" manifest key.
      • SPECIFICATION_TITLE_KEY

        private static final byte[] SPECIFICATION_TITLE_KEY
        The "Specification-Title" manifest key.
      • CLASS_PATH_KEY

        private static final byte[] CLASS_PATH_KEY
        The "Class-Path" manifest key.
      • BUNDLE_CLASSPATH_KEY

        private static final byte[] BUNDLE_CLASSPATH_KEY
        The "Bundle-ClassPath" manifest key.
      • SPRING_BOOT_CLASSES_KEY

        private static final byte[] SPRING_BOOT_CLASSES_KEY
        The "Spring-Boot-Classes" manifest key.
      • SPRING_BOOT_LIB_KEY

        private static final byte[] SPRING_BOOT_LIB_KEY
        The "Spring-Boot-Lib" manifest key.
      • MULTI_RELEASE_KEY

        private static final byte[] MULTI_RELEASE_KEY
        The "Multi-Release" manifest key.
      • ADD_EXPORTS_KEY

        private static final byte[] ADD_EXPORTS_KEY
        The "Add-Exports" manifest key.
      • ADD_OPENS_KEY

        private static final byte[] ADD_OPENS_KEY
        The "Add-Opens" manifest key.
      • AUTOMATIC_MODULE_NAME_KEY

        private static final byte[] AUTOMATIC_MODULE_NAME_KEY
        The "Automatic-Module-Name" manifest key.
      • toLowerCase

        private static byte[] toLowerCase
        For quickly converting ASCII characters to lower case.
    • Constructor Detail

      • LogicalZipFile

        LogicalZipFile​(ZipFileSlice zipFileSlice,
                       NestedJarHandler nestedJarHandler,
                       LogNode log,
                       boolean enableMultiReleaseVersions)
                throws java.io.IOException,
                       java.lang.InterruptedException
        Construct a logical zipfile from a slice of a physical zipfile.
        Parameters:
        zipFileSlice - the zipfile slice
        nestedJarHandler - the nested jar handler
        log - the log
        Throws:
        java.io.IOException - If an I/O exception occurs.
        java.lang.InterruptedException - if the thread was interrupted.
    • Method Detail

      • getManifestValue

        private static java.util.Map.Entry<java.lang.String,​java.lang.Integer> getManifestValue​(byte[] manifest,
                                                                                                      int startIdx)
        Extract a value from the manifest, and return the value as a string, along with the index after the terminating newline. Manifest files support three different line terminator types, and entries can be split across lines with a line terminator followed by a space.
        Parameters:
        manifest - the manifest bytes
        startIdx - the start index of the manifest value
        Returns:
        the manifest value
      • manifestKeyToBytes

        private static byte[] manifestKeyToBytes​(java.lang.String key)
        Manifest key to bytes.
        Parameters:
        key - the manifest key
        Returns:
        the manifest key bytes, lowercased.
      • keyMatchesAtPosition

        private static boolean keyMatchesAtPosition​(byte[] manifest,
                                                    byte[] key,
                                                    int pos)
        Key matches at position.
        Parameters:
        manifest - the manifest
        key - the key
        pos - the position to try matching
        Returns:
        true if the key matches at this position
      • parseManifest

        private void parseManifest​(FastZipEntry manifestZipEntry,
                                   LogNode log)
                            throws java.io.IOException,
                                   java.lang.InterruptedException
        Parse the manifest entry of a zipfile.
        Parameters:
        manifestZipEntry - the manifest zip entry
        log - the log
        Throws:
        java.io.IOException - If an I/O exception occurs.
        java.lang.InterruptedException - If the thread was interrupted.
      • readCentralDirectory

        private void readCentralDirectory​(NestedJarHandler nestedJarHandler,
                                          LogNode log)
                                   throws java.io.IOException,
                                          java.lang.InterruptedException
        Read the central directory of the zipfile.
        Parameters:
        nestedJarHandler - the nested jar handler
        log - the log
        Throws:
        java.io.IOException - If an I/O exception occurs.
        java.lang.InterruptedException - if the thread was interrupted.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class ZipFileSlice