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 Summary
Fields Modifier and Type Field Description private static byte[]
ADD_EXPORTS_KEY
The"Add-Exports"
manifest key.private static byte[]
ADD_OPENS_KEY
The"Add-Opens"
manifest key.java.lang.String
addExportsManifestEntryValue
The value of the "Add-Exports" manifest entry, if present in the manifest, else null.java.lang.String
addOpensManifestEntryValue
The value of the "Add-Opens" manifest entry, if present in the manifest, else null.private static byte[]
AUTOMATIC_MODULE_NAME_KEY
The"Automatic-Module-Name"
manifest key.java.lang.String
automaticModuleNameManifestEntryValue
The value of the "Automatic-Module-Name" manifest entry, if present in the manifest, else null.private static byte[]
BUNDLE_CLASSPATH_KEY
The"Bundle-ClassPath"
manifest key.java.lang.String
bundleClassPathManifestEntryValue
The value of the "Bundle-ClassPath" manifest entry, if present in the manifest, else null.private static byte[]
CLASS_PATH_KEY
The"Class-Path"
manifest key.java.lang.String
classPathManifestEntryValue
The value of the "Class-Path" manifest entry, if present in the manifest, else null.(package private) java.util.Set<java.lang.String>
classpathRoots
A set of classpath roots found in the classpath for this zipfile.private boolean
enableMultiReleaseVersions
If true, multi-release versions should not be stripped in resource names.java.util.List<FastZipEntry>
entries
The zipfile entries.private static byte[]
IMPLEMENTATION_TITLE_KEY
The"Implementation-Title"
manifest key.boolean
isJREJar
If true, this is a JRE jar.private boolean
isMultiReleaseJar
If true, this is a multi-release jar.private static java.lang.String
MANIFEST_PATH
"META-INF/MANIFEST.MF"
.(package private) static java.lang.String
META_INF_PATH_PREFIX
"META_INF/"
.private static byte[]
MULTI_RELEASE_KEY
The"Multi-Release"
manifest key.static java.lang.String
MULTI_RELEASE_PATH_PREFIX
"META-INF/versions/"
.private static byte[]
SPECIFICATION_TITLE_KEY
The"Specification-Title"
manifest key.private static byte[]
SPRING_BOOT_CLASSES_KEY
The"Spring-Boot-Classes"
manifest key.private static byte[]
SPRING_BOOT_LIB_KEY
The"Spring-Boot-Lib"
manifest key.private static byte[]
toLowerCase
For quickly converting ASCII characters to lower case.-
Fields inherited from class nonapi.io.github.classgraph.fastzipfilereader.ZipFileSlice
physicalZipFile, slice
-
-
Constructor Summary
Constructors Constructor Description LogicalZipFile(ZipFileSlice zipFileSlice, NestedJarHandler nestedJarHandler, LogNode log, boolean enableMultiReleaseVersions)
Construct a logical zipfile from a slice of a physical zipfile.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
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.int
hashCode()
private static boolean
keyMatchesAtPosition(byte[] manifest, byte[] key, int pos)
Key matches at position.private static byte[]
manifestKeyToBytes(java.lang.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.java.lang.String
toString()
-
Methods inherited from class nonapi.io.github.classgraph.fastzipfilereader.ZipFileSlice
getParentZipFileSlice, getPath, getPathWithinParentZipFileSlice, getPhysicalFile, isAcceptedAndNotRejected
-
-
-
-
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 slicenestedJarHandler
- the nested jar handlerlog
- 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 bytesstartIdx
- 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 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 java.io.IOException, java.lang.InterruptedException
Parse the manifest entry of a zipfile.- Parameters:
manifestZipEntry
- the manifest zip entrylog
- 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 handlerlog
- 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 classZipFileSlice
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classZipFileSlice
-
toString
public java.lang.String toString()
- Overrides:
toString
in classZipFileSlice
-
-