Top Fields Constructors Methods
org.python.core

public Class ClasspathPyImporter

extends importer<String>
Class Inheritance
Known Direct Subclasses
org.python.core.ClasspathPyImporterDerived
Annotations
@Untraversable
@ExposedType
name:ClasspathPyImporter
Imports
java.io.File, .IOException, .InputStream, java.util.Map, java.util.logging.Level, org.python.core.util.FileUtil, .StringUtil, .importer, org.python.expose.ExposedMethod, .ExposedNew, .ExposedType, org.python.util.Generic

Field Summary

Modifier and TypeField and Description
private Map<String, InputStream>
private String
public static final String
public static final PyType
Inherited from org.python.core.util.importer:
logger

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
pack-priv final void
pack-priv final PyObject

Returns:

a loader instance if this importer can load the module, None otherwise
ClasspathPyImporter_find_module
(String
the fully qualified name of the module
fullname
,
String
if not installed on the meta-path None or a module path
path
)

Find the module for the fully qualified name.

pack-priv final PyObject

Returns:

the module's PyCode object or None
ClasspathPyImporter_get_code
(String
the fully qualified name of the module
fullname
)

Return the code object associated with the module.

pack-priv final String
pack-priv final String
pack-priv final boolean

Returns:

whether the module is a package
ClasspathPyImporter_is_package
(String
the fully qualified name of the module
fullname
)

Determine whether a module is a package.

pack-priv final PyObject

Returns:

a loaded PyModule
ClasspathPyImporter_load_module
(String
the fully qualified name of the module
fullname
)

Load a module for the fully qualified name.

public String

Returns:

a String of data in binary mode (no CRLF)
get_data
(String
a String path name within the archive
path
)

Implements abstract org.python.core.util.importer.get_data.

Return the contents of the jarred file at the specified path as bytes.

public String

Returns:

a String of the module's source code or null
get_source
(String
the fully qualified name of the module
fullname
)

Return the source code for the module as a string (using newline characters for line endings)

protected String
getSeparator()

Implements abstract org.python.core.util.importer.getSeparator.

Returns the separator between directories and files used by this type of importer.

protected long
getSourceMtime(String
to the compiled file
path
)

Implements abstract org.python.core.util.importer.getSourceMtime.

Given a path to a compiled file in the archive, return the modification time of the matching .py file.

protected importer.Bundle
makeBundle(String fullFilename, String entry)

Implements abstract org.python.core.util.importer.makeBundle.

Returns a Bundle for fullFilename and entry, the result from a makeEntry call for fullFilename.

protected String
makeEntry(String filename)

Implements abstract org.python.core.util.importer.makeEntry.

Returns an entry for a filename from makeFilename with a potential suffix such that this importer can make a bundle with it, or null if fullFilename doesn't exist in this importer.

protected String
makeFilename(String fullname)

Implements abstract org.python.core.util.importer.makeFilename.

Given a full module name, return the potential file path in the archive (without extension).

protected String
makeFilePath(String fullname)

Implements abstract org.python.core.util.importer.makeFilePath.

Given a full module name, return the potential file path including the archive (without extension).

protected String
makePackagePath(String fullname)

Implements abstract org.python.core.util.importer.makePackagePath.

Returns the value to fill in __path__ on a module with the given full module name created by this importer.

private InputStream
tryClassLoader(String fullFilename, ClassLoader loader, String place)

Inherited from org.python.core.util.importer:
getModuleCodegetModuleInfoimporter_find_moduleimporter_is_packageimporter_load_module

Field Detail

entriesback to summary
private Map<String, InputStream> entries
pathback to summary
private String path
PYCLASSPATH_PREFIXback to summary
public static final String PYCLASSPATH_PREFIX
TYPEback to summary
public static final PyType TYPE

Hides org.python.core.PyObject.TYPE.

Constructor Detail

ClasspathPyImporterback to summary
public ClasspathPyImporter(PyType subType)
ClasspathPyImporterback to summary
public ClasspathPyImporter()

Method Detail

ClasspathPyImporter___init__back to summary
pack-priv final void ClasspathPyImporter___init__(PyObject[] args, String[] kwds)
Annotations
@ExposedNew
@ExposedMethod
ClasspathPyImporter_find_moduleback to summary
pack-priv final PyObject ClasspathPyImporter_find_module(String fullname, String path)

Find the module for the fully qualified name.

Parameters
fullname:String

the fully qualified name of the module

path:String

if not installed on the meta-path None or a module path

Returns:PyObject

a loader instance if this importer can load the module, None otherwise

Annotations
@ExposedMethod
defaults:null

ClasspathPyImporter_get_codeback to summary
pack-priv final PyObject ClasspathPyImporter_get_code(String fullname)

Return the code object associated with the module.

Parameters
fullname:String

the fully qualified name of the module

Returns:PyObject

the module's PyCode object or None

Annotations
@ExposedMethod

ClasspathPyImporter_get_databack to summary
pack-priv final String ClasspathPyImporter_get_data(String path)
Annotations
@ExposedMethod
ClasspathPyImporter_get_sourceback to summary
pack-priv final String ClasspathPyImporter_get_source(String fullname)
Annotations
@ExposedMethod
ClasspathPyImporter_is_packageback to summary
pack-priv final boolean ClasspathPyImporter_is_package(String fullname)

Determine whether a module is a package.

Parameters
fullname:String

the fully qualified name of the module

Returns:boolean

whether the module is a package

Annotations
@ExposedMethod

ClasspathPyImporter_load_moduleback to summary
pack-priv final PyObject ClasspathPyImporter_load_module(String fullname)

Load a module for the fully qualified name.

Parameters
fullname:String

the fully qualified name of the module

Returns:PyObject

a loaded PyModule

Annotations
@ExposedMethod

get_databack to summary
public String get_data(String path)

Implements abstract org.python.core.util.importer.get_data.

Return the contents of the jarred file at the specified path as bytes.

Parameters
path:String

a String path name within the archive

Returns:String

a String of data in binary mode (no CRLF)

Annotations
@Override

get_sourceback to summary
public String get_source(String fullname)

Return the source code for the module as a string (using newline characters for line endings)

Parameters
fullname:String

the fully qualified name of the module

Returns:String

a String of the module's source code or null

getSeparatorback to summary
protected String getSeparator()

Implements abstract org.python.core.util.importer.getSeparator.

Doc from org.python.core.util.importer.getSeparator.

Returns the separator between directories and files used by this type of importer.

Annotations
@Override
getSourceMtimeback to summary
protected long getSourceMtime(String path)

Implements abstract org.python.core.util.importer.getSourceMtime.

Doc from org.python.core.util.importer.getSourceMtime.

Given a path to a compiled file in the archive, return the modification time of the matching .py file.

Parameters
path:String

to the compiled file

Returns:long

long mtime of the .py, or -1 if no source is available

Annotations
@Override

makeBundleback to summary
protected importer.Bundle makeBundle(String fullFilename, String entry)

Implements abstract org.python.core.util.importer.makeBundle.

Doc from org.python.core.util.importer.makeBundle.

Returns a Bundle for fullFilename and entry, the result from a makeEntry call for fullFilename.

Annotations
@Override
makeEntryback to summary
protected String makeEntry(String filename)

Implements abstract org.python.core.util.importer.makeEntry.

Doc from org.python.core.util.importer.makeEntry.

Returns an entry for a filename from makeFilename with a potential suffix such that this importer can make a bundle with it, or null if fullFilename doesn't exist in this importer.

Annotations
@Override
makeFilenameback to summary
protected String makeFilename(String fullname)

Implements abstract org.python.core.util.importer.makeFilename.

Doc from org.python.core.util.importer.makeFilename.

Given a full module name, return the potential file path in the archive (without extension).

Annotations
@Override
makeFilePathback to summary
protected String makeFilePath(String fullname)

Implements abstract org.python.core.util.importer.makeFilePath.

Doc from org.python.core.util.importer.makeFilePath.

Given a full module name, return the potential file path including the archive (without extension).

Annotations
@Override
makePackagePathback to summary
protected String makePackagePath(String fullname)

Implements abstract org.python.core.util.importer.makePackagePath.

Doc from org.python.core.util.importer.makePackagePath.

Returns the value to fill in __path__ on a module with the given full module name created by this importer.

Annotations
@Override
tryClassLoaderback to summary
private InputStream tryClassLoader(String fullFilename, ClassLoader loader, String place)