Class LogicalZipFile
java.lang.Object
nonapi.io.github.classgraph.fastzipfilereader.ZipFileSlice
nonapi.io.github.classgraph.fastzipfilereader.LogicalZipFile
A logical zipfile, which represents a zipfile contained within a ZipFileSlice of a PhysicalZipFile.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final byte[]
The"Add-Exports"
manifest key.private static final byte[]
The"Add-Opens"
manifest key.The value of the "Add-Exports" manifest entry, if present in the manifest, else null.The value of the "Add-Opens" manifest entry, if present in the manifest, else null.private static final byte[]
The"Automatic-Module-Name"
manifest key.The value of the "Automatic-Module-Name" manifest entry, if present in the manifest, else null.private static final byte[]
The"Bundle-ClassPath"
manifest key.The value of the "Bundle-ClassPath" manifest entry, if present in the manifest, else null.private static final byte[]
The"Class-Path"
manifest key.The value of the "Class-Path" manifest entry, if present in the manifest, else null.A set of classpath roots found in the classpath for this zipfile.private final boolean
If true, multi-release versions should not be stripped in resource names.The zipfile entries.private static final byte[]
The"Implementation-Title"
manifest key.boolean
If true, this is a JRE jar.private boolean
If true, this is a multi-release jar.private static final String
"META-INF/MANIFEST.MF"
.(package private) static final String
"META_INF/"
.private static final byte[]
The"Multi-Release"
manifest key.static final String
"META-INF/versions/"
.private static final byte[]
The"Specification-Title"
manifest key.private static final byte[]
The"Spring-Boot-Classes"
manifest key.private static final byte[]
The"Spring-Boot-Lib"
manifest key.private static byte[]
For quickly converting ASCII characters to lower case.Fields inherited from class nonapi.io.github.classgraph.fastzipfilereader.ZipFileSlice
physicalZipFile, slice
-
Constructor Summary
ConstructorsConstructorDescriptionLogicalZipFile
(ZipFileSlice zipFileSlice, NestedJarHandler nestedJarHandler, LogNode log, boolean enableMultiReleaseVersions) Construct a logical zipfile from a slice of a physical zipfile. -
Method Summary
Modifier and TypeMethodDescriptionboolean
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.int
hashCode()
private static boolean
keyMatchesAtPosition
(byte[] manifest, byte[] key, int pos) Key matches at position.private static byte[]
manifestKeyToBytes
(String key) Manifest key to bytes.private void
parseManifest
(FastZipEntry manifestZipEntry, LogNode log) Parse the manifest entry of a zipfile.private void
readCentralDirectory
(NestedJarHandler nestedJarHandler, LogNode log) Read the central directory of the zipfile.toString()
Methods inherited from class nonapi.io.github.classgraph.fastzipfilereader.ZipFileSlice
getParentZipFileSlice, getPath, getPathWithinParentZipFileSlice, getPhysicalFile, isAcceptedAndNotRejected
-
Field Details
-
entries
The zipfile entries. -
isMultiReleaseJar
private boolean isMultiReleaseJarIf true, this is a multi-release jar. -
classpathRoots
A set of classpath roots found in the classpath for this zipfile. -
classPathManifestEntryValue
The value of the "Class-Path" manifest entry, if present in the manifest, else null. -
bundleClassPathManifestEntryValue
The value of the "Bundle-ClassPath" manifest entry, if present in the manifest, else null. -
addExportsManifestEntryValue
The value of the "Add-Exports" manifest entry, if present in the manifest, else null. -
addOpensManifestEntryValue
The value of the "Add-Opens" manifest entry, if present in the manifest, else null. -
automaticModuleNameManifestEntryValue
The value of the "Automatic-Module-Name" manifest entry, if present in the manifest, else null. -
isJREJar
public boolean isJREJarIf true, this is a JRE jar. -
enableMultiReleaseVersions
private final boolean enableMultiReleaseVersionsIf true, multi-release versions should not be stripped in resource names. -
META_INF_PATH_PREFIX
"META_INF/"
.- See Also:
-
MANIFEST_PATH
"META-INF/MANIFEST.MF"
.- See Also:
-
MULTI_RELEASE_PATH_PREFIX
"META-INF/versions/"
.- See Also:
-
IMPLEMENTATION_TITLE_KEY
private static final byte[] IMPLEMENTATION_TITLE_KEYThe"Implementation-Title"
manifest key. -
SPECIFICATION_TITLE_KEY
private static final byte[] SPECIFICATION_TITLE_KEYThe"Specification-Title"
manifest key. -
CLASS_PATH_KEY
private static final byte[] CLASS_PATH_KEYThe"Class-Path"
manifest key. -
BUNDLE_CLASSPATH_KEY
private static final byte[] BUNDLE_CLASSPATH_KEYThe"Bundle-ClassPath"
manifest key. -
SPRING_BOOT_CLASSES_KEY
private static final byte[] SPRING_BOOT_CLASSES_KEYThe"Spring-Boot-Classes"
manifest key. -
SPRING_BOOT_LIB_KEY
private static final byte[] SPRING_BOOT_LIB_KEYThe"Spring-Boot-Lib"
manifest key. -
MULTI_RELEASE_KEY
private static final byte[] MULTI_RELEASE_KEYThe"Multi-Release"
manifest key. -
ADD_EXPORTS_KEY
private static final byte[] ADD_EXPORTS_KEYThe"Add-Exports"
manifest key. -
ADD_OPENS_KEY
private static final byte[] ADD_OPENS_KEYThe"Add-Opens"
manifest key. -
AUTOMATIC_MODULE_NAME_KEY
private static final byte[] AUTOMATIC_MODULE_NAME_KEYThe"Automatic-Module-Name"
manifest key. -
toLowerCase
private static byte[] toLowerCaseFor quickly converting ASCII characters to lower case.
-
-
Constructor Details
-
LogicalZipFile
LogicalZipFile(ZipFileSlice zipFileSlice, NestedJarHandler nestedJarHandler, LogNode log, boolean enableMultiReleaseVersions) throws IOException, InterruptedException Construct a logical zipfile from a slice of a physical zipfile.- Parameters:
zipFileSlice
- the zipfile slicenestedJarHandler
- the nested jar handlerlog
- the log- Throws:
IOException
- If an I/O exception occurs.InterruptedException
- if the thread was interrupted.
-
-
Method Details
-
getManifestValue
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 bytesstartIdx
- the start index of the manifest value- Returns:
- the manifest value
-
manifestKeyToBytes
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 manifestkey
- the keypos
- 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 entrylog
- 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 handlerlog
- the log- Throws:
IOException
- If an I/O exception occurs.InterruptedException
- if the thread was interrupted.
-
equals
- Overrides:
equals
in classZipFileSlice
-
hashCode
public int hashCode()- Overrides:
hashCode
in classZipFileSlice
-
toString
- Overrides:
toString
in classZipFileSlice
-