Class PhysicalZipFile

java.lang.Object
nonapi.io.github.classgraph.fastzipfilereader.PhysicalZipFile

class PhysicalZipFile extends Object
A physical zipfile, which is mmap'd using a FileChannel.
  • Field Details

  • Constructor Details

    • PhysicalZipFile

      PhysicalZipFile(File file, NestedJarHandler nestedJarHandler, LogNode log) throws IOException
      Construct a PhysicalZipFile from a file on disk.
      Parameters:
      file - the file
      nestedJarHandler - the nested jar handler
      log - the log
      Throws:
      IOException - if an I/O exception occurs.
    • PhysicalZipFile

      PhysicalZipFile(Path path, NestedJarHandler nestedJarHandler, LogNode log) throws IOException
      Construct a PhysicalZipFile from a Path.
      Parameters:
      path - the path
      nestedJarHandler - the nested jar handler
      log - the log
      Throws:
      IOException - if an I/O exception occurs.
    • PhysicalZipFile

      PhysicalZipFile(byte[] arr, File outermostFile, String pathStr, NestedJarHandler nestedJarHandler) throws IOException
      Construct a PhysicalZipFile from a byte array.
      Parameters:
      arr - the array containing the zipfile.
      outermostFile - the outermost file
      pathStr - the path
      nestedJarHandler - 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 a PhysicalZipFile by reading from the InputStream to an array in RAM, or spill to disk if the InputStream is too long.
      Parameters:
      inputStream - the input stream
      inputStreamLengthHint - 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 zipfile
      nestedJarHandler - the nested jar handler
      log - the log
      Throws:
      IOException - if an I/O exception occurs.
  • Method Details

    • getPath

      public Path getPath()
      Get the Path for the outermost jar file of this PhysicalZipFile.
      Returns:
      the Path for the outermost jar file of this PhysicalZipFile, or null if this file was downloaded from a URL directly to RAM, or is backed by a File.
    • getFile

      public File getFile()
      Get the File for the outermost jar file of this PhysicalZipFile.
      Returns:
      the File for the outermost jar file of this PhysicalZipFile, or null if this file was downloaded from a URL directly to RAM, or is backed by a Path.
    • getPathStr

      public 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:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object