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

public Class FastZipEntry

extends Object
implements Comparable<FastZipEntry>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable
Imports
java.io.IOException, java.util.Calendar, .TimeZone, nonapi.io.github.classgraph.fileslice.Slice, nonapi.io.github.classgraph.fileslice.reader.RandomAccessReader, nonapi.io.github.classgraph.utils.VersionFinder

A zip entry within a LogicalZipFile.

Field Summary

Modifier and TypeField and Description
public final long
compressedSize

The compressed size of the zip entry, in bytes.

public final String
entryName

The zip entry path.

public final String
entryNameUnversioned

The unversioned entry name (i.e. entryName with "META_INF/versions/{versionInt}/" stripped)

public final int
fileAttributes

The file attributes for this resource, or 0 if unknown.

pack-priv final boolean
isDeflated

True if the zip entry is deflated; false if the zip entry is stored.

private final int
lastModifiedDateMSDOS

The last modified date in MSDOS format, if FastZipEntry#lastModifiedTimeMillis is 0L.

private long
lastModifiedTimeMillis

The last modified millis since the epoch, or 0L if it is unknown

private final int
lastModifiedTimeMSDOS

The last modified time in MSDOS format, if FastZipEntry#lastModifiedTimeMillis is 0L.

private final long
locHeaderPos

The offset of the entry's local header, as an offset relative to the parent logical zipfile.

pack-priv final LogicalZipFile
parentLogicalZipFile

The parent logical zipfile.

private Slice
slice

The Slice for the zip entry's raw data (which can be either stored or deflated).

public final long
uncompressedSize

The uncompressed size of the zip entry, in bytes.

pack-priv final int
version

The version code (>= 9), or 8 for the base layer or a non-versioned jar (whether JDK 7 or 8 compatible).

Constructor Summary

AccessConstructor and Description
pack-priv
FastZipEntry(final LogicalZipFile
The parent logical zipfile containing this entry.
parentLogicalZipFile
,
final long
The offset of the LOC header for this entry within the parent logical zipfile.
locHeaderPos
,
final String
The name of the entry.
entryName
,
final boolean
True if the entry is deflated; false if the entry is stored.
isDeflated
,
final long
The compressed size of the entry.
compressedSize
,
final long
The uncompressed size of the entry.
uncompressedSize
,
final long
The last modified date/time in millis since the epoch, or 0L if unknown (in which case, the MSDOS time and date fields will be provided).
lastModifiedTimeMillis
,
final int
The last modified date, in MSDOS format, if lastModifiedMillis is 0L.
lastModifiedTimeMSDOS
,
final int
The last modified date, in MSDOS format, if lastModifiedMillis is 0L.
lastModifiedDateMSDOS
,
final int
The POSIX file attribute bits from the zip entry.
fileAttributes
,
final boolean enableMultiReleaseVersions)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the result of comparison
compareTo
(final FastZipEntry
the object to compare to
o
)

Implements java.lang.Comparable.compareTo.

Sort in decreasing order of version number, then lexicographically increasing order of unversioned entry path.

public boolean
equals(final Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

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

public long

Returns:

the last modified time in Epoch millis.
getLastModifiedTimeMillis
()

Get the last modified time in Epoch millis, or 0L if unknown.

public String

Returns:

the path of the entry
getPath
()

Get the path to this zip entry, using "!/" as a separator between the parent logical zipfile and the entry name.

public Slice

Returns:

the offset within the physical zip file of the entry's start offset.
getSlice
()

Lazily get zip entry slice -- this is deferred until zip entry data needs to be read, in order to avoid randomly seeking within zipfile for every entry as the central directory is read.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

compressedSizeback to summary
public final long compressedSize

The compressed size of the zip entry, in bytes.

entryNameback to summary
public final String entryName

The zip entry path.

entryNameUnversionedback to summary
public final String entryNameUnversioned

The unversioned entry name (i.e. entryName with "META_INF/versions/{versionInt}/" stripped)

fileAttributesback to summary
public final int fileAttributes

The file attributes for this resource, or 0 if unknown.

isDeflatedback to summary
pack-priv final boolean isDeflated

True if the zip entry is deflated; false if the zip entry is stored.

lastModifiedDateMSDOSback to summary
private final int lastModifiedDateMSDOS

The last modified date in MSDOS format, if FastZipEntry#lastModifiedTimeMillis is 0L.

lastModifiedTimeMillisback to summary
private long lastModifiedTimeMillis

The last modified millis since the epoch, or 0L if it is unknown

lastModifiedTimeMSDOSback to summary
private final int lastModifiedTimeMSDOS

The last modified time in MSDOS format, if FastZipEntry#lastModifiedTimeMillis is 0L.

locHeaderPosback to summary
private final long locHeaderPos

The offset of the entry's local header, as an offset relative to the parent logical zipfile.

parentLogicalZipFileback to summary
pack-priv final LogicalZipFile parentLogicalZipFile

The parent logical zipfile.

sliceback to summary
private Slice slice

The Slice for the zip entry's raw data (which can be either stored or deflated).

uncompressedSizeback to summary
public final long uncompressedSize

The uncompressed size of the zip entry, in bytes.

versionback to summary
pack-priv final int version

The version code (>= 9), or 8 for the base layer or a non-versioned jar (whether JDK 7 or 8 compatible).

Constructor Detail

FastZipEntryback to summary
pack-priv FastZipEntry(final LogicalZipFile parentLogicalZipFile, final long locHeaderPos, final String entryName, final boolean isDeflated, final long compressedSize, final long uncompressedSize, final long lastModifiedTimeMillis, final int lastModifiedTimeMSDOS, final int lastModifiedDateMSDOS, final int fileAttributes, final boolean enableMultiReleaseVersions)

Constructor.

Parameters
parentLogicalZipFile:LogicalZipFile

The parent logical zipfile containing this entry.

locHeaderPos:long

The offset of the LOC header for this entry within the parent logical zipfile.

entryName:String

The name of the entry.

isDeflated:boolean

True if the entry is deflated; false if the entry is stored.

compressedSize:long

The compressed size of the entry.

uncompressedSize:long

The uncompressed size of the entry.

lastModifiedTimeMillis:long

The last modified date/time in millis since the epoch, or 0L if unknown (in which case, the MSDOS time and date fields will be provided).

lastModifiedTimeMSDOS:int

The last modified date, in MSDOS format, if lastModifiedMillis is 0L.

lastModifiedDateMSDOS:int

The last modified date, in MSDOS format, if lastModifiedMillis is 0L.

fileAttributes:int

The POSIX file attribute bits from the zip entry.

Method Detail

compareToback to summary
public int compareTo(final FastZipEntry o)

Implements java.lang.Comparable.compareTo.

Sort in decreasing order of version number, then lexicographically increasing order of unversioned entry path.

Parameters
o:FastZipEntry

the object to compare to

Returns:int

the result of comparison

Annotations
@Override
equalsback to summary
public boolean equals(final Object obj)

Overrides java.lang.Object.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
obj: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
getLastModifiedTimeMillisback to summary
public long getLastModifiedTimeMillis()

Get the last modified time in Epoch millis, or 0L if unknown.

Returns:long

the last modified time in Epoch millis.

getPathback to summary
public String getPath()

Get the path to this zip entry, using "!/" as a separator between the parent logical zipfile and the entry name.

Returns:String

the path of the entry

getSliceback to summary
public Slice getSlice() throws IOException

Lazily get zip entry slice -- this is deferred until zip entry data needs to be read, in order to avoid randomly seeking within zipfile for every entry as the central directory is read.

Returns:Slice

the offset within the physical zip file of the entry's start offset.

Exceptions
IOException:
If an I/O exception occurs.
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.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
toStringback to summary
public String toString()

Overrides java.lang.Object.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