Top Description Fields Constructors Methods
nonapi.io.github.classgraph.fastzipfilereader

public Class LogicalZipFile

extends ZipFileSlice
Class Inheritance
Imports
java.io.ByteArrayOutputStream, .EOFException, .IOException, .UnsupportedEncodingException, java.nio.charset.StandardCharsets, java.util.AbstractMap.SimpleEntry, .ArrayList, .Collections, .HashMap, .HashSet, .List, .Map, .Map.Entry, .Set, java.util.concurrent.ConcurrentHashMap, nonapi.io.github.classgraph.fileslice.ArraySlice, nonapi.io.github.classgraph.fileslice.reader.RandomAccessReader, nonapi.io.github.classgraph.utils.CollectionUtils, .FileUtils, .LogNode, .StringUtils, .VersionFinder

A logical zipfile, which represents a zipfile contained within a ZipFileSlice of a PhysicalZipFile.

Field Summary

Modifier and TypeField and Description
private static final byte[]
ADD_EXPORTS_KEY

The "Add-Exports" manifest key.

private static final byte[]
ADD_OPENS_KEY

The "Add-Opens" manifest key.

public String
addExportsManifestEntryValue

The value of the "Add-Exports" manifest entry, if present in the manifest, else null.

public String
addOpensManifestEntryValue

The value of the "Add-Opens" manifest entry, if present in the manifest, else null.

private static final byte[]
AUTOMATIC_MODULE_NAME_KEY

The "Automatic-Module-Name" manifest key.

public String
automaticModuleNameManifestEntryValue

The value of the "Automatic-Module-Name" manifest entry, if present in the manifest, else null.

private static final byte[]
BUNDLE_CLASSPATH_KEY

The "Bundle-ClassPath" manifest key.

public String
bundleClassPathManifestEntryValue

The value of the "Bundle-ClassPath" manifest entry, if present in the manifest, else null.

private static final byte[]
CLASS_PATH_KEY

The "Class-Path" manifest key.

public String
classPathManifestEntryValue

The value of the "Class-Path" manifest entry, if present in the manifest, else null.

pack-priv Set<String>
classpathRoots

A set of classpath roots found in the classpath for this zipfile.

private final boolean
enableMultiReleaseVersions

If true, multi-release versions should not be stripped in resource names.

public List<FastZipEntry>
entries

The zipfile entries.

private static final byte[]
IMPLEMENTATION_TITLE_KEY

The "Implementation-Title" manifest key.

public boolean
isJREJar

If true, this is a JRE jar.

private boolean
isMultiReleaseJar

If true, this is a multi-release jar.

private static final String
MANIFEST_PATH

"META-INF/MANIFEST.MF".

pack-priv static final String
private static final byte[]
MULTI_RELEASE_KEY

The "Multi-Release" manifest key.

public static final String
MULTI_RELEASE_PATH_PREFIX

"META-INF/versions/".

private static final byte[]
SPECIFICATION_TITLE_KEY

The "Specification-Title" manifest key.

private static final byte[]
SPRING_BOOT_CLASSES_KEY

The "Spring-Boot-Classes" manifest key.

private static final byte[]
SPRING_BOOT_LIB_KEY

The "Spring-Boot-Lib" manifest key.

private static byte[]
toLowerCase

For quickly converting ASCII characters to lower case.

Inherited from nonapi.io.github.classgraph.fastzipfilereader.ZipFileSlice:
physicalZipFileslice

Constructor Summary

AccessConstructor and Description
pack-priv
LogicalZipFile(final ZipFileSlice
the zipfile slice
zipFileSlice
,
final NestedJarHandler
the nested jar handler
nestedJarHandler
,
final LogNode
the log
log
,
final boolean enableMultiReleaseVersions)

Construct a logical zipfile from a slice of a physical zipfile.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(final Object
the reference object with which to compare.
o
)

Overrides nonapi.io.github.classgraph.fastzipfilereader.ZipFileSlice.equals.

Indicates whether some other object is "equal to" this one.

private static Map.Entry<String, Integer>

Returns:

the manifest value
getManifestValue
(final byte[]
the manifest bytes
manifest
,
final int
the start index of the manifest value
startIdx
)

Extract a value from the manifest, and return the value as a string, along with the index after the terminating newline.

public int
hashCode()

Overrides nonapi.io.github.classgraph.fastzipfilereader.ZipFileSlice.hashCode.

Returns a hash code value for this object.

private static boolean

Returns:

true if the key matches at this position
keyMatchesAtPosition
(final byte[]
the manifest
manifest
,
final byte[]
the key
key
,
final int
the position to try matching
pos
)

Key matches at position.

private static byte[]

Returns:

the manifest key bytes, lowercased.
manifestKeyToBytes
(final String
the manifest key
key
)

Manifest key to bytes.

private void
parseManifest(final FastZipEntry
the manifest zip entry
manifestZipEntry
,
final LogNode
the log
log
)

Parse the manifest entry of a zipfile.

private void
readCentralDirectory(final NestedJarHandler
the nested jar handler
nestedJarHandler
,
final LogNode
the log
log
)

Read the central directory of the zipfile.

public String
toString()

Overrides nonapi.io.github.classgraph.fastzipfilereader.ZipFileSlice.toString.

Returns a string representation of the object.

Inherited from nonapi.io.github.classgraph.fastzipfilereader.ZipFileSlice:
getParentZipFileSlicegetPathgetPathWithinParentZipFileSlicegetPhysicalFileisAcceptedAndNotRejected

Field Detail

ADD_EXPORTS_KEYback to summary
private static final byte[] ADD_EXPORTS_KEY

The "Add-Exports" manifest key.

ADD_OPENS_KEYback to summary
private static final byte[] ADD_OPENS_KEY

The "Add-Opens" manifest key.

addExportsManifestEntryValueback to summary
public String addExportsManifestEntryValue

The value of the "Add-Exports" manifest entry, if present in the manifest, else null.

addOpensManifestEntryValueback to summary
public String addOpensManifestEntryValue

The value of the "Add-Opens" manifest entry, if present in the manifest, else null.

AUTOMATIC_MODULE_NAME_KEYback to summary
private static final byte[] AUTOMATIC_MODULE_NAME_KEY

The "Automatic-Module-Name" manifest key.

automaticModuleNameManifestEntryValueback to summary
public String automaticModuleNameManifestEntryValue

The value of the "Automatic-Module-Name" manifest entry, if present in the manifest, else null.

BUNDLE_CLASSPATH_KEYback to summary
private static final byte[] BUNDLE_CLASSPATH_KEY

The "Bundle-ClassPath" manifest key.

bundleClassPathManifestEntryValueback to summary
public String bundleClassPathManifestEntryValue

The value of the "Bundle-ClassPath" manifest entry, if present in the manifest, else null.

CLASS_PATH_KEYback to summary
private static final byte[] CLASS_PATH_KEY

The "Class-Path" manifest key.

classPathManifestEntryValueback to summary
public String classPathManifestEntryValue

The value of the "Class-Path" manifest entry, if present in the manifest, else null.

classpathRootsback to summary
pack-priv Set<String> classpathRoots

A set of classpath roots found in the classpath for this zipfile.

enableMultiReleaseVersionsback to summary
private final boolean enableMultiReleaseVersions

If true, multi-release versions should not be stripped in resource names.

entriesback to summary
public List<FastZipEntry> entries

The zipfile entries.

IMPLEMENTATION_TITLE_KEYback to summary
private static final byte[] IMPLEMENTATION_TITLE_KEY

The "Implementation-Title" manifest key.

isJREJarback to summary
public boolean isJREJar

If true, this is a JRE jar.

isMultiReleaseJarback to summary
private boolean isMultiReleaseJar

If true, this is a multi-release jar.

MANIFEST_PATHback to summary
private static final String MANIFEST_PATH

"META-INF/MANIFEST.MF".

META_INF_PATH_PREFIXback to summary
pack-priv static final String META_INF_PATH_PREFIX

"META_INF/".

MULTI_RELEASE_KEYback to summary
private static final byte[] MULTI_RELEASE_KEY

The "Multi-Release" manifest key.

MULTI_RELEASE_PATH_PREFIXback to summary
public static final String MULTI_RELEASE_PATH_PREFIX

"META-INF/versions/".

SPECIFICATION_TITLE_KEYback to summary
private static final byte[] SPECIFICATION_TITLE_KEY

The "Specification-Title" manifest key.

SPRING_BOOT_CLASSES_KEYback to summary
private static final byte[] SPRING_BOOT_CLASSES_KEY

The "Spring-Boot-Classes" manifest key.

SPRING_BOOT_LIB_KEYback to summary
private static final byte[] SPRING_BOOT_LIB_KEY

The "Spring-Boot-Lib" manifest key.

toLowerCaseback to summary
private static byte[] toLowerCase

For quickly converting ASCII characters to lower case.

Constructor Detail

LogicalZipFileback to summary
pack-priv LogicalZipFile(final ZipFileSlice zipFileSlice, final NestedJarHandler nestedJarHandler, final LogNode log, final boolean enableMultiReleaseVersions) throws IOException, InterruptedException

Construct a logical zipfile from a slice of a physical zipfile.

Parameters
zipFileSlice:ZipFileSlice

the zipfile slice

nestedJarHandler:NestedJarHandler

the nested jar handler

log:LogNode

the log

Exceptions
IOException:
If an I/O exception occurs.
InterruptedException:
if the thread was interrupted.

Method Detail

equalsback to summary
public boolean equals(final Object o)

Overrides nonapi.io.github.classgraph.fastzipfilereader.ZipFileSlice.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getManifestValueback to summary
private static Map.Entry<String, Integer> getManifestValue(final byte[] manifest, final 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:byte[]

the manifest bytes

startIdx:int

the start index of the manifest value

Returns:Map.Entry<String, Integer>

the manifest value

hashCodeback to summary
public int hashCode()

Overrides nonapi.io.github.classgraph.fastzipfilereader.ZipFileSlice.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
keyMatchesAtPositionback to summary
private static boolean keyMatchesAtPosition(final byte[] manifest, final byte[] key, final int pos)

Key matches at position.

Parameters
manifest:byte[]

the manifest

key:byte[]

the key

pos:int

the position to try matching

Returns:boolean

true if the key matches at this position

manifestKeyToBytesback to summary
private static byte[] manifestKeyToBytes(final String key)

Manifest key to bytes.

Parameters
key:String

the manifest key

Returns:byte[]

the manifest key bytes, lowercased.

parseManifestback to summary
private void parseManifest(final FastZipEntry manifestZipEntry, final LogNode log) throws IOException, InterruptedException

Parse the manifest entry of a zipfile.

Parameters
manifestZipEntry:FastZipEntry

the manifest zip entry

log:LogNode

the log

Exceptions
IOException:
If an I/O exception occurs.
InterruptedException:
If the thread was interrupted.
readCentralDirectoryback to summary
private void readCentralDirectory(final NestedJarHandler nestedJarHandler, final LogNode log) throws IOException, InterruptedException

Read the central directory of the zipfile.

Parameters
nestedJarHandler:NestedJarHandler

the nested jar handler

log:LogNode

the log

Annotations
@SuppressWarnings:resource
Exceptions
IOException:
If an I/O exception occurs.
InterruptedException:
if the thread was interrupted.
toStringback to summary
public String toString()

Overrides nonapi.io.github.classgraph.fastzipfilereader.ZipFileSlice.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override