Class PhysicalZipFile


  • class PhysicalZipFile
    extends java.lang.Object
    A physical zipfile, which is mmap'd using a FileChannel.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      java.io.File getFile()
      Get the File for the outermost jar file of this PhysicalZipFile.
      java.nio.file.Path getPath()
      Get the Path for the outermost jar file of this PhysicalZipFile.
      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.
      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.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • path

        private java.nio.file.Path path
        The Path backing this PhysicalZipFile, if any.
      • file

        private java.io.File file
        The File backing this PhysicalZipFile, if any.
      • pathStr

        private final java.lang.String pathStr
        The path to the zipfile.
      • hashCode

        private int hashCode
        The cached hashCode.
    • Constructor Detail

      • PhysicalZipFile

        PhysicalZipFile​(java.io.File file,
                        NestedJarHandler nestedJarHandler,
                        LogNode log)
                 throws java.io.IOException
        Construct a PhysicalZipFile from a file on disk.
        Parameters:
        file - the file
        nestedJarHandler - the nested jar handler
        log - 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.IOException
        Construct a PhysicalZipFile from a Path.
        Parameters:
        path - the path
        nestedJarHandler - the nested jar handler
        log - 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.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:
        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.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:
        java.io.IOException - if an I/O exception occurs.
    • Method Detail

      • getPath

        public java.nio.file.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 java.io.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 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:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object