本文整理了Java中bsh.Interpreter.source()
方法的一些代码示例,展示了Interpreter.source()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Interpreter.source()
方法的具体详情如下:
包路径:bsh.Interpreter
类名称:Interpreter
方法名:source
[英]Read text from fileName and eval it. Convenience method. Use the global namespace.
[中]从文件名中读取文本并对其求值。方便方法。使用全局命名空间。
代码示例来源:origin: beanshell/beanshell
/**
Read text from fileName and eval it.
Convenience method. Use the global namespace.
*/
public Object source( String filename )
throws FileNotFoundException, IOException, EvalError
{
return source( filename, globalNameSpace );
}
代码示例来源:origin: jitlogic/zorka
/**
Read text from fileName and eval it.
Convenience method. Use the global namespace.
*/
public Object source( String filename )
throws FileNotFoundException, IOException, EvalError
{
return source( filename, globalNameSpace );
}
代码示例来源:origin: jpos/jPOS
public void actionPerformed (ActionEvent ev) {
String bshSource = ev.getActionCommand();
try {
Interpreter bsh = new Interpreter ();
bsh.source (bshSource);
} catch (Exception e) {
e.printStackTrace();
}
}
}
代码示例来源:origin: beanshell/beanshell
void loadRCFiles() {
try {
// Default is c:\windows under win98, $HOME under Unix
String rcfile =
System.getProperty("user.home") + File.separator + ".bshrc";
source( rcfile, globalNameSpace );
} catch ( Exception e ) {
// squeltch security exception, filenotfoundexception
Interpreter.debug("Could not find rc file: ", e);
}
}
代码示例来源:origin: jitlogic/zorka
void loadRCFiles() {
try {
String rcfile =
// Default is c:\windows under win98, $HOME under Unix
System.getProperty("user.home") + File.separator + ".bshrc";
source( rcfile, globalNameSpace );
} catch ( Exception e ) {
// squeltch security exception, filenotfoundexception
if ( Interpreter.DEBUG ) debug("Could not find rc file: "+e);
}
}
代码示例来源:origin: stackoverflow.com
Interpreter i = new Interpreter();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
System.setOut(ps);
try {
//i.eval("System.out.println(\"test\");");
i.source("c:\\htdocs\\test.bsh");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String out = "hello : "+baos.toString();
System.err.println(out);
代码示例来源:origin: jpos/jPOS
private boolean eval (Interpreter bsh, String script, String source)
throws EvalError, IOException
{
boolean rc = false;
if (script != null) {
Object retValue = bsh.eval (script);
if (source != null)
retValue = bsh.source (source);
if (retValue instanceof Boolean) {
rc = (Boolean) retValue;
}
}
return rc;
}
}
代码示例来源:origin: jpos/jPOS
protected Interpreter initInterpreter(Map arguments) throws EvalError, IOException {
Interpreter i = new Interpreter();
Map.Entry entry;
for (Object o : arguments.entrySet()) {
entry = (Map.Entry) o;
i.set((String) entry.getKey(), entry.getValue());
}
if (source) {
i.source(bshData);
} else {
i.eval(bshData);
}
return i;
}
代码示例来源:origin: stackoverflow.com
Interpreter i = new Interpreter();
NameSpace ns = i.getNameSpace();
ns.setVariable("args", new String[]{"param1", "param2"}, false);
i.source("Target.bsh");
代码示例来源:origin: jitlogic/zorka
try {
Object result =
interpreter.source( filename, interpreter.globalNameSpace );
if ( result instanceof Class )
try {
代码示例来源:origin: jpos/jPOS
Object ret= bsh.source(script);
代码示例来源:origin: org.andromda/andromda-script-wrappers
this.interpreter.source(scriptPath);
this.interpreter.set(
"instance",
代码示例来源:origin: beanshell/beanshell
interpreter.setu( "bsh.args", bshArgs );
Object result =
interpreter.source( filename, interpreter.globalNameSpace );
if ( result instanceof Class )
try {
代码示例来源:origin: jpos/jPOS
public void run () {
Element config = getPersist();
try {
bsh.set ("qbean", this);
bsh.set ("log", getLog());
bsh.set ("cfg", getConfiguration());
bsh.eval (config.getText());
String source = config.getAttributeValue ("source");
if (source != null)
bsh.source (source);
} catch (Throwable e) {
getLog().warn (e);
}
}
}
代码示例来源:origin: jpos/jPOS
bsh.set("evt", evt);
bsh.set("cfg", cfg);
Object r = bsh.source(aSource);
if (r instanceof ISOMsg)
m = (ISOMsg) r;
内容来源于网络,如有侵权,请联系作者删除!