當前位置: 首頁>>代碼示例>>Java>>正文


Java Path.list方法代碼示例

本文整理匯總了Java中org.apache.tools.ant.types.Path.list方法的典型用法代碼示例。如果您正苦於以下問題:Java Path.list方法的具體用法?Java Path.list怎麽用?Java Path.list使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.tools.ant.types.Path的用法示例。


在下文中一共展示了Path.list方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: execute

import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
public void execute() throws BuildException {
    if (paths.isEmpty()) {
        throw new BuildException ("Source dir or fileset required to scan for images");
    }
    if (outDir == null) {
        throw new BuildException ("Output directory for cache file must be specified");
    }
    
    try {
        CacheWriter writer = new CacheWriter();
        writer.setDir(outDir.toString(), clean);

        Iterator it = paths.iterator();
        while (it.hasNext()) {
            Path curr = (Path) it.next();
            String[] dirs = curr.list();
            for (int i=0; i < dirs.length; i++) {
                System.err.println("WriteDir " + dirs[i]);
                writer.writeDir(dirs[i], true);
            }
        }
    } catch (IOException ioe) {
        ioe.printStackTrace();
        throw new BuildException (ioe.getMessage());
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:CacheWriterTask.java

示例2: testProjectsNotSet

import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
@Test
public void testProjectsNotSet() {
    task.setWorkspacedir(TESTWORKSPACE);
    task.setProjects("");
    task.execute();
    Path path = (Path) project.getReference("resolved.projects.path");
    String[] entries = path.list();
    assertEquals(4, entries.length);
    assertEquals(new File("resources/testworkspace/project-lib")
            .getAbsolutePath(), entries[0]);
    assertEquals(new File("resources/testworkspace/project-a")
            .getAbsolutePath(), entries[1]);
    assertEquals(new File("resources/testworkspace/project-b")
            .getAbsolutePath(), entries[2]);
    assertEquals(new File("resources/testworkspace/project-c")
            .getAbsolutePath(), entries[3]);
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:18,代碼來源:DependencyResolverTaskTest.java

示例3: testSetClasspathRef1

import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
/** This test is created to satisfy pitest, it is hard to emulate Reference by Id. */
@Test
public void testSetClasspathRef1() {
    final CheckstyleAntTask antTask = new CheckstyleAntTask();
    final Project project = new Project();
    antTask.setClasspath(new Path(project, "firstPath"));
    antTask.setClasspathRef(new Reference(project, "idXX"));

    try {
        assertNotNull("Classpath should not be null",
                Whitebox.getInternalState(antTask, "classpath"));
        final Path classpath = (Path) Whitebox.getInternalState(antTask, "classpath");
        classpath.list();
        fail("Exception is expected");
    }
    catch (BuildException ex) {
        assertEquals("unexpected exception message",
                "Reference idXX not found.", ex.getMessage());
    }
}
 
開發者ID:rnveach,項目名稱:checkstyle-backport-jre6,代碼行數:21,代碼來源:CheckstyleAntTaskTest.java

示例4: createClassLoader

import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
protected GroovyClassLoader createClassLoader() {
    GroovyClassLoader gcl =
            AccessController.doPrivileged(
                    new PrivilegedAction<GroovyClassLoader>() {
                        @Override
                        public GroovyClassLoader run() {
                            return new GroovyClassLoader(ClassLoader.getSystemClassLoader(), config);
                        }
                    });

    Path path = getClasspath();
    if (path != null) {
        final String[] filePaths = path.list();
        for (int i = 0; i < filePaths.length; i++) {
            String filePath = filePaths[i];
            gcl.addClasspath(filePath);
        }
    }

    return gcl;
}
 
開發者ID:apache,項目名稱:groovy,代碼行數:22,代碼來源:CompileTaskSupport.java

示例5: loadRegisteredScriptExtensions

import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
private void loadRegisteredScriptExtensions() {
    if (scriptExtensions.isEmpty()) {

        scriptExtensions.add(getScriptExtension().substring(2)); // first extension will be the one set explicitly on <groovyc>

        Path classpath = getClasspath() != null ? getClasspath() : new Path(getProject());
        final String[] pe = classpath.list();
        try (GroovyClassLoader loader = new GroovyClassLoader(getClass().getClassLoader())) {
            for (String file : pe) {
                loader.addClasspath(file);
            }
            scriptExtensions.addAll(SourceExtensionHandler.getRegisteredExtensions(loader));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
 
開發者ID:apache,項目名稱:groovy,代碼行數:18,代碼來源:Groovyc.java

示例6: verifyPathAdheresToDesign

import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
private void verifyPathAdheresToDesign(Design d, Path p) throws ClassFormatException, IOException {
	String files[] = p.list();
	for (int i = 0; i < files.length; i++) {
		File file = new File(files[i]);
		if (file.isDirectory()) {
			FileSet set = new FileSet();
			set.setDir(file);
			set.setProject(task.getProject());
			PatternSet.NameEntry entry1 = set.createInclude();
			PatternSet.NameEntry entry2 = set.createInclude();
			PatternSet.NameEntry entry3 = set.createInclude();
			entry1.setName("**/*.class");
			entry2.setName("**/*.jar");
			entry3.setName("**/*.war");
			DirectoryScanner scanner = set.getDirectoryScanner(task.getProject());
			scanner.setBasedir(file);
			String[] scannerFiles = scanner.getIncludedFiles();
			for (int j = 0; j < scannerFiles.length; j++) {
				verifyPartOfPath(scannerFiles[j], new File(file, scannerFiles[j]), d);
			}
		} else
			verifyPartOfPath(files[i], file, d);
	}
}
 
開發者ID:cniweb,項目名稱:ant-contrib,代碼行數:25,代碼來源:VerifyDesignDelegate.java

示例7: getSorted

import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
private String[] getSorted(String property) {
    Path path = new Path(project);
    path.setPath(property);
    String paths[] = path.list();

    String rets [] = new String[paths.length];
    for (int i = 0; i < paths.length; i++) {
        rets[i] = new File(paths[i]).getName();

    }
    return rets;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:SortSuiteModulesTest.java

示例8: getLazyJarsSet

import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
private static Set<? extends File> getLazyJarsSet(final Project prj, final List<? extends File> runCp, final Path value) {
    final Set<File> result = new HashSet<File>();
    if (value != null) {
        for (String pathElement : value.list()) {
            result.add(prj.resolveFile(pathElement));
        }
    }
    for (File re : runCp) {
        if (Project.toBoolean(prj.getProperty(String.format(JNLP_LAZY_FORMAT, re.getName())))) {
            result.add(re);
        }
    }
    return result;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:GenerateJnlpFileTask.java

示例9: verifyPaths

import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
static void verifyPaths(Project project, Path path) {
    if (path == null) return ;
    String[] paths = path.list();
    for (int i = 0; i < paths.length; i++) {
        String pathName = project.replaceProperties(paths[i]);
        File file = FileUtil.normalizeFile
            (project.resolveFile (pathName));
        if (!file.exists()) {
            project.log("Non-existing path \""+pathName+"\" provided.", Project.MSG_WARN);
            //throw new BuildException("Non-existing path \""+paths[i]+"\" provided.");
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:JPDAStart.java

示例10: convertToClassPath

import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
private static ClassPath convertToClassPath (Project project, Path path) {
    String[] paths = path == null ? new String [0] : path.list ();
    List l = new ArrayList ();
    int i, k = paths.length;
    for (i = 0; i < k; i++) {
        String pathName = project.replaceProperties(paths[i]);
        File f = FileUtil.normalizeFile (project.resolveFile (pathName));
        if (!isValid (f, project)) continue;
        URL url = fileToURL (f, project, true, false);
        if (url == null) continue;
        l.add (url);
    }
    URL[] urls = (URL[]) l.toArray (new URL [l.size ()]);
    return ClassPathSupport.createClassPath (urls);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:JPDAStart.java

示例11: testProjectLib

import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
@Test
public void testProjectLib() {
    task.setWorkspacedir(TESTWORKSPACE);
    task.setProjects("project-lib");
    task.execute();
    Path path = (Path) project.getReference("resolved.projects.path");
    String[] entries = path.list();
    assertEquals(1, entries.length);
    assertEquals(new File("resources/testworkspace/project-lib")
            .getAbsolutePath(), entries[0]);
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:12,代碼來源:DependencyResolverTaskTest.java

示例12: testProjectA

import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
@Test
public void testProjectA() {
    task.setWorkspacedir(TESTWORKSPACE);
    task.setProjects("project-a");
    task.execute();
    Path path = (Path) project.getReference("resolved.projects.path");
    String[] entries = path.list();
    assertEquals(2, entries.length);
    assertEquals(new File("resources/testworkspace/project-lib")
            .getAbsolutePath(), entries[0]);
    assertEquals(new File("resources/testworkspace/project-a")
            .getAbsolutePath(), entries[1]);
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:14,代碼來源:DependencyResolverTaskTest.java

示例13: testProjectAandLib

import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
@Test
public void testProjectAandLib() {
    task.setWorkspacedir(TESTWORKSPACE);
    task.setProjects("project-a, project-lib");
    task.execute();
    Path path = (Path) project.getReference("resolved.projects.path");
    String[] entries = path.list();
    assertEquals(2, entries.length);
    assertEquals(new File("resources/testworkspace/project-lib")
            .getAbsolutePath(), entries[0]);
    assertEquals(new File("resources/testworkspace/project-a")
            .getAbsolutePath(), entries[1]);
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:14,代碼來源:DependencyResolverTaskTest.java

示例14: testProjectBandA

import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
@Test
public void testProjectBandA() {
    task.setWorkspacedir(TESTWORKSPACE);
    task.setProjects("project-b, project-a");
    task.execute();
    Path path = (Path) project.getReference("resolved.projects.path");
    String[] entries = path.list();
    assertEquals(3, entries.length);
    assertEquals(new File("resources/testworkspace/project-lib")
            .getAbsolutePath(), entries[0]);
    assertEquals(new File("resources/testworkspace/project-b")
            .getAbsolutePath(), entries[1]);
    assertEquals(new File("resources/testworkspace/project-a")
            .getAbsolutePath(), entries[2]);
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:16,代碼來源:DependencyResolverTaskTest.java

示例15: processExtraResourcesPaths

import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
/**
 * Process any extraresourcespath elements provided to this task and
 * include the resources they refer to in the given set.
 */
private void processExtraResourcesPaths(Set<URL> resources) {
  for(Path p : extraResourcesPaths) {
    for(String resource : p.list()) {
      File resourceFile = new File(resource);
      try {
        resources.add(resourceFile.toURI().toURL());
      }
      catch(MalformedURLException e) {
        throw new BuildException("Couldn't construct URL for extra resource "
                + resourceFile, e, getLocation());
      }
    }
  }
}
 
開發者ID:GateNLP,項目名稱:gate-core,代碼行數:19,代碼來源:PackageGappTask.java


注:本文中的org.apache.tools.ant.types.Path.list方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。