Class zipimporter

    • Field Detail

      • TYPE

        public static final PyType TYPE
      • __doc__

        public static final PyString __doc__
      • archive

        public java.lang.String archive
        Path to the Zip archive
      • prefix

        public java.lang.String prefix
        File prefix: "a/sub/directory/"
      • files

        public PyObject files
        Dict with file info {path: tocEntry}
    • Constructor Detail

      • zipimporter

        public zipimporter()
      • zipimporter

        public zipimporter​(PyType subType)
      • zipimporter

        public zipimporter​(java.lang.String path)
    • Method Detail

      • getArchive

        public PyString getArchive()
        Path to the Zip archive as FS-encoded str.
      • find_module

        public PyObject find_module​(java.lang.String fullname)
      • find_module

        public PyObject find_module​(java.lang.String fullname,
                                    java.lang.String path)
        Find the module for the fully qualified name.
        Parameters:
        fullname - the fully qualified name of the module
        path - if not installed on the meta-path None or a module path
        Returns:
        a loader instance if this importer can load the module, None otherwise
      • load_module

        public PyObject load_module​(java.lang.String fullname)
        Load a module for the fully qualified name.
        Parameters:
        fullname - the fully qualified name of the module
        Returns:
        a loaded PyModule
      • get_data

        public java.lang.String get_data​(java.lang.String path)
        Return the uncompressed data for the file at the specified path as bytes.
        Specified by:
        get_data in class importer<PyObject>
        Parameters:
        path - a String path name within the archive
        Returns:
        a String of data in binary mode (no CRLF)
      • is_package

        public boolean is_package​(java.lang.String fullname)
        Return a boolean signifying whether the module is a package or not.
        Parameters:
        fullname - the fully qualified name of the module
        Returns:
        a boolean describing if the module is a package
      • get_code

        public PyObject get_code​(java.lang.String fullname)
        Return the code object associated with the module.
        Parameters:
        fullname - the fully qualified name of the module
        Returns:
        the module's PyCode object or None
      • get_filename

        public PyObject get_filename​(java.lang.String fullname)
      • get_source

        public java.lang.String get_source​(java.lang.String fullname)
        Return the source code for the module as a string (using newline characters for line endings)
        Parameters:
        fullname - the fully qualified name of the module
        Returns:
        a String of the module's source code or null
      • makeBundle

        public org.python.modules.zipimport.zipimporter.ZipBundle makeBundle​(java.lang.String datapath,
                                                                             PyObject entry)
        Given a path to a compressed file in the archive, return the file's (uncompressed) data stream in a ZipBundle.
        Parameters:
        datapath - file's filename inside of the archive
        Returns:
        a ZipBundle with an InputStream to the file's uncompressed data
      • toString

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