Class FastZipEntry
- java.lang.Object
-
- nonapi.io.github.classgraph.fastzipfilereader.FastZipEntry
-
- All Implemented Interfaces:
Comparable<FastZipEntry>
public class FastZipEntry extends Object implements Comparable<FastZipEntry>
A zip entry within aLogicalZipFile.
-
-
Field Summary
Fields Modifier and Type Field Description longcompressedSizeThe compressed size of the zip entry, in bytes.StringentryNameThe zip entry path.StringentryNameUnversionedThe unversioned entry name (i.e.booleanisDeflatedTrue if the zip entry is deflated; false if the zip entry is stored.longuncompressedSizeThe uncompressed size of the zip entry, in bytes.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, String entryName, boolean isDeflated, long compressedSize, long uncompressedSize, NestedJarHandler nestedJarHandler)
-
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(Object obj)StringgetPath()Get the path to this zip entry, using "!/" as a separator between the parent logical zipfile and the entry name.inthashCode()byte[]load(LogNode log)Load the content of the zip entry, and return it as a byte array.StringloadAsString(LogNode log)Load the content of the zip entry, and return it as a String (converting from UTF-8 byte format).InputStreamopen()Open the data of the zip entry as anInputStream, inflating the data if the entry is deflated.StringtoString()
-
-
-
Field Detail
-
entryName
public final String entryName
The zip entry path.
-
isDeflated
public 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.
-
version
public 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 String entryNameUnversioned
The unversioned entry name (i.e. entryName with "META_INF/versions/{versionInt}/" stripped)
-
-
Constructor Detail
-
FastZipEntry
public FastZipEntry(LogicalZipFile parentLogicalZipFile, long locHeaderPos, String entryName, boolean isDeflated, long compressedSize, long uncompressedSize, NestedJarHandler nestedJarHandler)
- 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.nestedJarHandler- TheNestedJarHandler.
-
-
Method Detail
-
open
public InputStream open() throws IOException
Open the data of the zip entry as anInputStream, inflating the data if the entry is deflated.- Throws:
IOException
-
load
public byte[] load(LogNode log) throws IOException
Load the content of the zip entry, and return it as a byte array.- Throws:
IOException
-
loadAsString
public String loadAsString(LogNode log) throws IOException
Load the content of the zip entry, and return it as a String (converting from UTF-8 byte format).- Throws:
IOException
-
getPath
public String getPath()
Get the path to this zip entry, using "!/" as a separator between the parent logical zipfile and the entry name.
-
compareTo
public int compareTo(FastZipEntry o)
Sort in decreasing order of version number, then lexicographically increasing order of unversioned entry path.- Specified by:
compareToin interfaceComparable<FastZipEntry>
-
-