public class imp extends Object
Modifier and Type | Class and Description |
---|---|
static class |
imp.CodeData |
static class |
imp.CodeImport |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_LEVEL |
static int |
NO_MTIME |
Modifier and Type | Method and Description |
---|---|
static PyModule |
addModule(String name)
If the given name is found in sys.modules, the entry from there is returned.
|
static String |
cacheCompiledSource(String sourceFilename,
String compiledFilename,
byte[] compiledSource)
Stores the bytes in compiledSource in compiledFilename.
|
static boolean |
caseok(File file,
String filename) |
static byte[] |
compileSource(String name,
File file) |
static byte[] |
compileSource(String name,
File file,
String sourceFilename) |
static byte[] |
compileSource(String name,
File file,
String sourceFilename,
String compiledFilename) |
static byte[] |
compileSource(String name,
InputStream fp,
String filename) |
static byte[] |
compileSource(String name,
InputStream fp,
String filename,
long mtime) |
static PyObject |
createFromCode(String name,
PyCode c)
Returns a module with the given name whose contents are the results of running c.
|
static PyObject |
createFromCode(String name,
PyCode c,
String moduleLocation)
Returns a module with the given name whose contents are the results of running c.
|
static PyObject |
createFromSource(String name,
InputStream fp,
String filename) |
static PyObject |
createFromSource(String name,
InputStream fp,
String filename,
String outFilename) |
static PyObject |
createFromSource(String name,
InputStream fp,
String filename,
String outFilename,
long mtime) |
static int |
getAPIVersion() |
static PyObject |
getImporter(PyObject p) |
static ClassLoader |
getParentClassLoader()
Selects the parent class loader for Jython, to be used for dynamically loaded classes and
resources.
|
static ClassLoader |
getSyspathJavaLoader() |
static void |
importAll(PyObject module,
PyFrame frame) |
static void |
importAll(String mod,
PyFrame frame)
Deprecated.
|
static void |
importAll(String mod,
PyFrame frame,
int level)
Called from jython generated code when a statement like "from spam.eggs import *" is
executed.
|
static PyObject[] |
importFrom(String mod,
String[] names,
PyFrame frame)
Deprecated.
use importFrom with level param.
|
static PyObject[] |
importFrom(String mod,
String[] names,
PyFrame frame,
int level)
Called from jython generated code when a statement like "from spam.eggs import foo, bar" is
executed.
|
static PyObject[] |
importFromAs(String mod,
String[] names,
PyFrame frame)
Deprecated.
use importFromAs with level param.
|
static PyObject[] |
importFromAs(String mod,
String[] names,
String[] asnames,
PyFrame frame,
int level)
Called from jython generated code when a statement like "from spam.eggs import foo as spam"
is executed.
|
static PyObject |
importName(String name,
boolean top)
Import a module by name.
|
static PyObject |
importName(String name,
boolean top,
PyObject modDict,
PyObject fromlist,
int level)
Import a module by name.
|
static PyObject |
importOne(String mod,
PyFrame frame)
Deprecated.
|
static PyObject |
importOne(String mod,
PyFrame frame,
int level)
Called from jython generated code when a statement like "import spam" is executed.
|
static PyObject |
importOneAs(String mod,
PyFrame frame)
Deprecated.
|
static PyObject |
importOneAs(String mod,
PyFrame frame,
int level)
Called from jython generated code when a statement like "import spam as foo" is executed.
|
static PyObject |
load(String name)
Load the module by name.
|
static PyObject |
loadFromCompiled(String name,
InputStream stream,
String sourceName,
String compiledName) |
static String |
makeCompiledFilename(String filename)
Remove the last three characters of a file name and add the compiled suffix "$py.class".
|
static byte[] |
readCode(String name,
InputStream fp,
boolean testing) |
static byte[] |
readCode(String name,
InputStream fp,
boolean testing,
long mtime) |
static imp.CodeData |
readCodeData(String name,
InputStream fp,
boolean testing) |
static imp.CodeData |
readCodeData(String name,
InputStream fp,
boolean testing,
long mtime) |
public static final int NO_MTIME
public static final int DEFAULT_LEVEL
public static ClassLoader getSyspathJavaLoader()
public static ClassLoader getParentClassLoader()
public static PyModule addModule(String name)
public static byte[] readCode(String name, InputStream fp, boolean testing) throws IOException
IOException
public static byte[] readCode(String name, InputStream fp, boolean testing, long mtime) throws IOException
IOException
public static imp.CodeData readCodeData(String name, InputStream fp, boolean testing) throws IOException
IOException
public static imp.CodeData readCodeData(String name, InputStream fp, boolean testing, long mtime) throws IOException
IOException
public static byte[] compileSource(String name, File file, String sourceFilename, String compiledFilename)
public static String makeCompiledFilename(String filename)
public static String cacheCompiledSource(String sourceFilename, String compiledFilename, byte[] compiledSource)
public static byte[] compileSource(String name, InputStream fp, String filename)
public static byte[] compileSource(String name, InputStream fp, String filename, long mtime)
public static PyObject createFromSource(String name, InputStream fp, String filename)
public static PyObject createFromSource(String name, InputStream fp, String filename, String outFilename)
public static PyObject createFromSource(String name, InputStream fp, String filename, String outFilename, long mtime)
public static PyObject createFromCode(String name, PyCode c)
public static PyObject createFromCode(String name, PyCode c, String moduleLocation)
public static PyObject loadFromCompiled(String name, InputStream stream, String sourceName, String compiledName)
public static PyObject load(String name)
name
- the name of the module to loadpublic static PyObject importName(String name, boolean top)
name
- the name of the package to importtop
- if true, return the top module in the name, otherwise the lastpublic static PyObject importName(String name, boolean top, PyObject modDict, PyObject fromlist, int level)
name
- the name of the package to importtop
- if true, return the top module in the name, otherwise the lastmodDict
- the __dict__ of an already imported module@Deprecated public static PyObject importOne(String mod, PyFrame frame)
public static PyObject importOne(String mod, PyFrame frame, int level)
@Deprecated public static PyObject importOneAs(String mod, PyFrame frame)
public static PyObject importOneAs(String mod, PyFrame frame, int level)
@Deprecated public static PyObject[] importFrom(String mod, String[] names, PyFrame frame)
public static PyObject[] importFrom(String mod, String[] names, PyFrame frame, int level)
@Deprecated public static PyObject[] importFromAs(String mod, String[] names, PyFrame frame)
public static PyObject[] importFromAs(String mod, String[] names, String[] asnames, PyFrame frame, int level)
public static void importAll(String mod, PyFrame frame, int level)
@Deprecated public static void importAll(String mod, PyFrame frame)
public static int getAPIVersion()