Class LogicalZipFile

java.lang.Object
nonapi.io.github.classgraph.fastzipfilereader.ZipFileSlice
nonapi.io.github.classgraph.fastzipfilereader.LogicalZipFile

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

    • entries

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

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

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

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

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

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

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

      public 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 String META_INF_PATH_PREFIX
      "META_INF/".
      See Also:
    • MANIFEST_PATH

      private static final String MANIFEST_PATH
      "META-INF/MANIFEST.MF".
      See Also:
    • MULTI_RELEASE_PATH_PREFIX

      public static final String MULTI_RELEASE_PATH_PREFIX
      "META-INF/versions/".
      See Also:
    • 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 Details

  • Method Details

    • getManifestValue

      private static Map.Entry<String,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(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 IOException, InterruptedException
      Parse the manifest entry of a zipfile.
      Parameters:
      manifestZipEntry - the manifest zip entry
      log - the log
      Throws:
      IOException - If an I/O exception occurs.
      InterruptedException - If the thread was interrupted.
    • readCentralDirectory

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

      public boolean equals(Object o)
      Overrides:
      equals in class ZipFileSlice
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class ZipFileSlice
    • toString

      public String toString()
      Overrides:
      toString in class ZipFileSlice