Class PhysicalZipFile
java.lang.Object
nonapi.io.github.classgraph.fastzipfilereader.PhysicalZipFile
A physical zipfile, which is mmap'd using a
FileChannel
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate File
TheFile
backing thisPhysicalZipFile
, if any.private int
The cached hashCode.(package private) NestedJarHandler
The nested jar handler.private Path
ThePath
backing thisPhysicalZipFile
, if any.private final String
The path to the zipfile.(package private) Slice
TheSlice
for the zipfile. -
Constructor Summary
ConstructorsConstructorDescriptionPhysicalZipFile
(byte[] arr, File outermostFile, String pathStr, NestedJarHandler nestedJarHandler) Construct aPhysicalZipFile
from a byte array.PhysicalZipFile
(File file, NestedJarHandler nestedJarHandler, LogNode log) Construct aPhysicalZipFile
from a file on disk.PhysicalZipFile
(InputStream inputStream, long inputStreamLengthHint, String pathStr, NestedJarHandler nestedJarHandler, LogNode log) Construct aPhysicalZipFile
by reading from theInputStream
to an array in RAM, or spill to disk if theInputStream
is too long.PhysicalZipFile
(Path path, NestedJarHandler nestedJarHandler, LogNode log) Construct aPhysicalZipFile
from aPath
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getFile()
Get theFile
for the outermost jar file of this PhysicalZipFile.getPath()
Get thePath
for the outermost jar file of this PhysicalZipFile.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.int
hashCode()
long
length()
Get the length of the mapped file, or the initial remaining bytes in the wrapped ByteBuffer if a buffer was wrapped.toString()
-
Field Details
-
path
ThePath
backing thisPhysicalZipFile
, if any. -
file
TheFile
backing thisPhysicalZipFile
, if any. -
pathStr
The path to the zipfile. -
slice
Slice sliceTheSlice
for the zipfile. -
nestedJarHandler
NestedJarHandler nestedJarHandlerThe nested jar handler. -
hashCode
private int hashCodeThe cached hashCode.
-
-
Constructor Details
-
PhysicalZipFile
PhysicalZipFile(File file, NestedJarHandler nestedJarHandler, LogNode log) throws IOException Construct aPhysicalZipFile
from a file on disk.- Parameters:
file
- the filenestedJarHandler
- the nested jar handlerlog
- the log- Throws:
IOException
- if an I/O exception occurs.
-
PhysicalZipFile
PhysicalZipFile(Path path, NestedJarHandler nestedJarHandler, LogNode log) throws IOException Construct aPhysicalZipFile
from aPath
.- Parameters:
path
- the pathnestedJarHandler
- the nested jar handlerlog
- the log- Throws:
IOException
- if an I/O exception occurs.
-
PhysicalZipFile
PhysicalZipFile(byte[] arr, File outermostFile, String pathStr, NestedJarHandler nestedJarHandler) throws IOException Construct aPhysicalZipFile
from a byte array.- Parameters:
arr
- the array containing the zipfile.outermostFile
- the outermost filepathStr
- the pathnestedJarHandler
- the nested jar handler- Throws:
IOException
- if an I/O exception occurs.
-
PhysicalZipFile
PhysicalZipFile(InputStream inputStream, long inputStreamLengthHint, String pathStr, NestedJarHandler nestedJarHandler, LogNode log) throws IOException Construct aPhysicalZipFile
by reading from theInputStream
to an array in RAM, or spill to disk if theInputStream
is 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:
IOException
- if an I/O exception occurs.
-
-
Method Details
-
getPath
Get thePath
for the outermost jar file of this PhysicalZipFile. -
getFile
Get theFile
for the outermost jar file of this PhysicalZipFile. -
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() -
equals
-
toString
-