bsh.Interpreter.pathToFile()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(1.3k)|赞(0)|评价(0)|浏览(188)

本文整理了Java中bsh.Interpreter.pathToFile()方法的一些代码示例,展示了Interpreter.pathToFile()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Interpreter.pathToFile()方法的具体详情如下:
包路径:bsh.Interpreter
类名称:Interpreter
方法名:pathToFile

Interpreter.pathToFile介绍

[英]Localize a path to the file name based on the bsh.cwd interpreter working directory.
[中]基于bsh本地化文件名的路径。cwd解释器工作目录。

代码示例

代码示例来源:origin: jitlogic/zorka

/**
  Read text from fileName and eval it.
*/
public Object source( String filename, NameSpace nameSpace ) 
  throws FileNotFoundException, IOException, EvalError 
{
  File file = pathToFile( filename );
  if ( Interpreter.DEBUG ) debug("Sourcing file: "+file);
  Reader sourceIn = new BufferedReader( new FileReader(file) );
  try {
    return eval( sourceIn, nameSpace, filename );
  } finally {
    sourceIn.close();
  }
}

代码示例来源:origin: beanshell/beanshell

String path;
try {
  path = env.pathToFile( dir ).getAbsolutePath();
  file =  env.pathToFile( dir );
} catch (IOException e ) {
  env.println("error reading path: "+e);

代码示例来源:origin: beanshell/beanshell

/**
  Read text from fileName and eval it.
*/
public Object source( String filename, NameSpace nameSpace )
  throws FileNotFoundException, IOException, EvalError
{
  File file = pathToFile( filename );
  Interpreter.debug("Sourcing file: ", file);
  Reader sourceIn = new BufferedReader( new FileReader(file) );
  try {
    return eval( sourceIn, nameSpace, filename );
  } finally {
    sourceIn.close();
  }
}

相关文章