Class FastZipEntry
- java.lang.Object
-
- nonapi.io.github.classgraph.fastzipfilereader.FastZipEntry
-
- All Implemented Interfaces:
java.lang.Comparable<FastZipEntry>
public class FastZipEntry extends java.lang.Object implements java.lang.Comparable<FastZipEntry>
A zip entry within aLogicalZipFile.
-
-
Field Summary
Fields Modifier and Type Field Description longcompressedSizeThe compressed size of the zip entry, in bytes.java.lang.StringentryNameThe zip entry path.java.lang.StringentryNameUnversionedThe unversioned entry name (i.e.intfileAttributesThe file attributes for this resource, or 0 if unknown.(package private) booleanisDeflatedTrue if the zip entry is deflated; false if the zip entry is stored.private intlastModifiedDateMSDOSThe last modified date in MSDOS format, iflastModifiedTimeMillisis 0L.private longlastModifiedTimeMillisThe last modified millis since the epoch, or 0L if it is unknownprivate intlastModifiedTimeMSDOSThe last modified time in MSDOS format, iflastModifiedTimeMillisis 0L.private longlocHeaderPosThe offset of the entry's local header, as an offset relative to the parent logical zipfile.(package private) LogicalZipFileparentLogicalZipFileThe parent logical zipfile.private SlicesliceTheSlicefor the zip entry's raw data (which can be either stored or deflated).longuncompressedSizeThe uncompressed size of the zip entry, in bytes.(package private) intversionThe version code (>= 9), or 8 for the base layer or a non-versioned jar (whether JDK 7 or 8 compatible).
-
Constructor Summary
Constructors Constructor Description FastZipEntry(LogicalZipFile parentLogicalZipFile, long locHeaderPos, java.lang.String entryName, boolean isDeflated, long compressedSize, long uncompressedSize, long lastModifiedTimeMillis, int lastModifiedTimeMSDOS, int lastModifiedDateMSDOS, int fileAttributes, boolean enableMultiReleaseVersions)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(FastZipEntry o)Sort in decreasing order of version number, then lexicographically increasing order of unversioned entry path.booleanequals(java.lang.Object obj)longgetLastModifiedTimeMillis()Get the last modified time in Epoch millis, or 0L if unknown.java.lang.StringgetPath()Get the path to this zip entry, using "!/" as a separator between the parent logical zipfile and the entry name.SlicegetSlice()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.inthashCode()java.lang.StringtoString()
-
-
-
Field Detail
-
parentLogicalZipFile
final LogicalZipFile parentLogicalZipFile
The parent logical zipfile.
-
locHeaderPos
private final long locHeaderPos
The offset of the entry's local header, as an offset relative to the parent logical zipfile.
-
entryName
public final java.lang.String entryName
The zip entry path.
-
isDeflated
final boolean isDeflated
True if the zip entry is deflated; false if the zip entry is stored.
-
compressedSize
public final long compressedSize
The compressed size of the zip entry, in bytes.
-
uncompressedSize
public final long uncompressedSize
The uncompressed size of the zip entry, in bytes.
-
lastModifiedTimeMillis
private long lastModifiedTimeMillis
The last modified millis since the epoch, or 0L if it is unknown
-
lastModifiedTimeMSDOS
private final int lastModifiedTimeMSDOS
The last modified time in MSDOS format, iflastModifiedTimeMillisis 0L.
-
lastModifiedDateMSDOS
private final int lastModifiedDateMSDOS
The last modified date in MSDOS format, iflastModifiedTimeMillisis 0L.
-
fileAttributes
public final int fileAttributes
The file attributes for this resource, or 0 if unknown.
-
slice
private Slice slice
TheSlicefor the zip entry's raw data (which can be either stored or deflated).
-
version
final int version
The version code (>= 9), or 8 for the base layer or a non-versioned jar (whether JDK 7 or 8 compatible).
-
entryNameUnversioned
public final java.lang.String entryNameUnversioned
The unversioned entry name (i.e. entryName with "META_INF/versions/{versionInt}/" stripped)
-
-
Constructor Detail
-
FastZipEntry
FastZipEntry(LogicalZipFile parentLogicalZipFile, long locHeaderPos, java.lang.String entryName, boolean isDeflated, long compressedSize, long uncompressedSize, long lastModifiedTimeMillis, int lastModifiedTimeMSDOS, int lastModifiedDateMSDOS, int fileAttributes, boolean enableMultiReleaseVersions)
Constructor.- Parameters:
parentLogicalZipFile- The parent logical zipfile containing this entry.locHeaderPos- The offset of the LOC header for this entry within the parent logical zipfile.entryName- The name of the entry.isDeflated- True if the entry is deflated; false if the entry is stored.compressedSize- The compressed size of the entry.uncompressedSize- The uncompressed size of the entry.lastModifiedTimeMillis- 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- The last modified date, in MSDOS format, if lastModifiedMillis is 0L.lastModifiedDateMSDOS- The last modified date, in MSDOS format, if lastModifiedMillis is 0L.fileAttributes- The POSIX file attribute bits from the zip entry.
-
-
Method Detail
-
getSlice
public Slice getSlice() throws java.io.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:
- the offset within the physical zip file of the entry's start offset.
- Throws:
java.io.IOException- If an I/O exception occurs.
-
getPath
public java.lang.String getPath()
Get the path to this zip entry, using "!/" as a separator between the parent logical zipfile and the entry name.- Returns:
- the path of the entry
-
getLastModifiedTimeMillis
public long getLastModifiedTimeMillis()
Get the last modified time in Epoch millis, or 0L if unknown.- Returns:
- the last modified time in Epoch millis.
-
compareTo
public int compareTo(FastZipEntry o)
Sort in decreasing order of version number, then lexicographically increasing order of unversioned entry path.- Specified by:
compareToin interfacejava.lang.Comparable<FastZipEntry>- Parameters:
o- the object to compare to- Returns:
- the result of comparison
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-