当前位置: 首页>>代码示例>>Java>>正文


Java Path.toString方法代码示例

本文整理汇总了Java中org.apache.tools.ant.types.Path.toString方法的典型用法代码示例。如果您正苦于以下问题:Java Path.toString方法的具体用法?Java Path.toString怎么用?Java Path.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tools.ant.types.Path的用法示例。


在下文中一共展示了Path.toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getClassPath

import org.apache.tools.ant.types.Path; //导入方法依赖的package包/类
public String getClassPath() {
  Path totalPath = null;
  for (Path p : classPaths) {
    if (totalPath == null) {
      totalPath = p;
      continue;
    }
    totalPath.add(p);
  }

  return totalPath != null ? totalPath.toString() : DEFAULT_FILTER;
}
 
开发者ID:mhevery,项目名称:testability-explorer,代码行数:13,代码来源:TaskModel.java

示例2: getClassPath

import org.apache.tools.ant.types.Path; //导入方法依赖的package包/类
protected static String getClassPath(File buildDir) {
    Path path = new CommandlineJava().createClasspath(new Project());
    path.createPathElement().setPath(System.getProperty("java.class.path"));
    path.createPathElement().setPath(buildDir.getPath());
    return path.toString();
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:7,代码来源:TestHelper.java

示例3: execute

import org.apache.tools.ant.types.Path; //导入方法依赖的package包/类
public void execute() throws BuildException {

	if (outputDir == null) {
	    throw new BuildException ("no output directory declared!");
	}

	if (!outputDir.exists()) {
	    throw new BuildException ("Output directory doesn't exist:" + outputDir);
	}

	String javaHome = System.getProperty("java.home");
	String javaBin = javaHome + File.separator + "bin" + File.separator + "java";
        String classpath = System.getProperty("java.class.path");

	// add on our own paths
	String allPaths = "";
	for (Path p : paths) {
	    classpath  += ":" + p.toString();
	}

	for (FileSet fs : filesets) {

	    for (Iterator it = fs.iterator(); it.hasNext(); ) {
		FileResource res = (FileResource) it.next();
		
		// convert name into CLASS (trim .java and replace slashes)
		String name = res.getName();
		name = name.substring (0, name.length()-5);
		String className = name.replace('/', '.');
	    
		try {

		    ProcessBuilder builder = new ProcessBuilder(javaBin, "-cp", classpath, className);
		    Process process = builder.start();

		    // process output
		    InputStream is = process.getInputStream();
		    InputStreamReader isr = new InputStreamReader(is);
		    BufferedReader br = new BufferedReader (isr);
		    
		    File outFile = new File (outputDir, className + ".output");
		    PrintStream ps = new PrintStream (outFile);

		    // generic start/stop info for each output file.
		    Date d = new Date();
		    ps.println ("Start:" + d.getTime() + " [" + d + "]");

		    String s;
		    int nb = 0;
		    while ((s = br.readLine()) != null) {
			nb += s.length();
			ps.println(s);
		    }

		    // generic end
		    d = new Date();
		    ps.println ("End:" + d.getTime() + " [" + d + "]");

		    ps.close();

		    int ev = process.exitValue();
		    System.out.println (className + " [" + nb + " bytes output, exit code:" + ev + "]");
		    
		} catch (Exception e) {
		    throw new BuildException ("unable to process class " + className + ": " + e.getMessage());
		}
	    }
	}
    }
 
开发者ID:heineman,项目名称:algorithms-nutshell-2ed,代码行数:70,代码来源:RunAll.java


注:本文中的org.apache.tools.ant.types.Path.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。