Class PhysicalZipFile
- java.lang.Object
-
- nonapi.io.github.classgraph.fastzipfilereader.PhysicalZipFile
-
class PhysicalZipFile extends java.lang.ObjectA physical zipfile, which is mmap'd using aFileChannel.
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.FilefileTheFilebacking thisPhysicalZipFile, if any.private inthashCodeThe cached hashCode.(package private) NestedJarHandlernestedJarHandlerThe nested jar handler.private java.nio.file.PathpathThePathbacking thisPhysicalZipFile, if any.private java.lang.StringpathStrThe path to the zipfile.(package private) SlicesliceTheSlicefor the zipfile.
-
Constructor Summary
Constructors Constructor Description PhysicalZipFile(byte[] arr, java.io.File outermostFile, java.lang.String pathStr, NestedJarHandler nestedJarHandler)Construct aPhysicalZipFilefrom a byte array.PhysicalZipFile(java.io.File file, NestedJarHandler nestedJarHandler, LogNode log)Construct aPhysicalZipFilefrom a file on disk.PhysicalZipFile(java.io.InputStream inputStream, long inputStreamLengthHint, java.lang.String pathStr, NestedJarHandler nestedJarHandler, LogNode log)Construct aPhysicalZipFileby reading from theInputStreamto an array in RAM, or spill to disk if theInputStreamis too long.PhysicalZipFile(java.nio.file.Path path, NestedJarHandler nestedJarHandler, LogNode log)Construct aPhysicalZipFilefrom aPath.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)java.io.FilegetFile()Get theFilefor the outermost jar file of this PhysicalZipFile.java.nio.file.PathgetPath()Get thePathfor the outermost jar file of this PhysicalZipFile.java.lang.StringgetPathStr()Get the path for this PhysicalZipFile, which is the file path, if it is file-backed, or a compound nested jar path, if it is memory-backed.inthashCode()longlength()Get the length of the mapped file, or the initial remaining bytes in the wrapped ByteBuffer if a buffer was wrapped.java.lang.StringtoString()
-
-
-
Field Detail
-
path
private java.nio.file.Path path
ThePathbacking thisPhysicalZipFile, if any.
-
file
private java.io.File file
TheFilebacking thisPhysicalZipFile, if any.
-
pathStr
private final java.lang.String pathStr
The path to the zipfile.
-
nestedJarHandler
NestedJarHandler nestedJarHandler
The nested jar handler.
-
hashCode
private int hashCode
The cached hashCode.
-
-
Constructor Detail
-
PhysicalZipFile
PhysicalZipFile(java.io.File file, NestedJarHandler nestedJarHandler, LogNode log) throws java.io.IOExceptionConstruct aPhysicalZipFilefrom a file on disk.- Parameters:
file- the filenestedJarHandler- the nested jar handlerlog- the log- Throws:
java.io.IOException- if an I/O exception occurs.
-
PhysicalZipFile
PhysicalZipFile(java.nio.file.Path path, NestedJarHandler nestedJarHandler, LogNode log) throws java.io.IOExceptionConstruct aPhysicalZipFilefrom aPath.- Parameters:
path- the pathnestedJarHandler- the nested jar handlerlog- the log- Throws:
java.io.IOException- if an I/O exception occurs.
-
PhysicalZipFile
PhysicalZipFile(byte[] arr, java.io.File outermostFile, java.lang.String pathStr, NestedJarHandler nestedJarHandler) throws java.io.IOExceptionConstruct aPhysicalZipFilefrom a byte array.- Parameters:
arr- the array containing the zipfile.outermostFile- the outermost filepathStr- the pathnestedJarHandler- the nested jar handler- Throws:
java.io.IOException- if an I/O exception occurs.
-
PhysicalZipFile
PhysicalZipFile(java.io.InputStream inputStream, long inputStreamLengthHint, java.lang.String pathStr, NestedJarHandler nestedJarHandler, LogNode log) throws java.io.IOExceptionConstruct aPhysicalZipFileby reading from theInputStreamto an array in RAM, or spill to disk if theInputStreamis too long.- Parameters:
inputStream- the input streaminputStreamLengthHint- The number of bytes to read in inputStream, or -1 if unknown.pathStr- the source URL the InputStream was opened from, or the zip entry path of this entry in the parent zipfilenestedJarHandler- the nested jar handlerlog- the log- Throws:
java.io.IOException- if an I/O exception occurs.
-
-
Method Detail
-
getPath
public java.nio.file.Path getPath()
Get thePathfor the outermost jar file of this PhysicalZipFile.- Returns:
- the
Pathfor the outermost jar file of this PhysicalZipFile, or null if this file was downloaded from a URL directly to RAM, or is backed by aFile.
-
getFile
public java.io.File getFile()
Get theFilefor the outermost jar file of this PhysicalZipFile.- Returns:
- the
Filefor the outermost jar file of this PhysicalZipFile, or null if this file was downloaded from a URL directly to RAM, or is backed by aPath.
-
getPathStr
public java.lang.String getPathStr()
Get the path for this PhysicalZipFile, which is the file path, if it is file-backed, or a compound nested jar path, if it is memory-backed.- Returns:
- the path for this PhysicalZipFile, which is the file path, if it is file-backed, or a compound nested jar path, if it is memory-backed.
-
length
public long length()
Get the length of the mapped file, or the initial remaining bytes in the wrapped ByteBuffer if a buffer was wrapped.- Returns:
- the length of the mapped file
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-