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


Java FileSet.createInclude方法代碼示例

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


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

示例1: getFilesByNameEntryFilter

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
 * Returns a list of files found in a given folder, matching a given filter.
 * @param folder the folder to search
 * @param filters the filter for the files. Typically a glob.
 * @return an iterator.
 */
private Iterator<?> getFilesByNameEntryFilter(String folder, String... filters) {
    Project taskProject = getProject();

    // create a fileset to find all the files in the folder
    FileSet fs = new FileSet();
    fs.setProject(taskProject);
    fs.setDir(new File(folder));
    for (String filter : filters) {
        NameEntry include = fs.createInclude();
        include.setName(filter);
    }

    // loop through the results of the file set
    return fs.iterator();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:MultiFilesTask.java

示例2: verifyPathAdheresToDesign

import org.apache.tools.ant.types.FileSet; //導入方法依賴的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

示例3: doExecute

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
public void doExecute() throws BuildException {
    prepareAndCheck();
    if (setid == null) {
        throw new BuildException("setid is required in ivy cachefileset");
    }
    try {
        final List<ArtifactDownloadReport> artifactDownloadReports = getArtifactReports();
        if (artifactDownloadReports.isEmpty()) {
            // generate an empty fileset
            final FileSet emptyFileSet = new EmptyFileSet();
            emptyFileSet.setProject(getProject());
            getProject().addReference(setid, emptyFileSet);
            return;
        }
        // find a common base dir of the resolved artifacts
        final File baseDir = this.requireCommonBaseDir(artifactDownloadReports);
        final FileSet fileset = new FileSet();
        fileset.setDir(baseDir);
        fileset.setProject(getProject());
        // enroll each of the artifact files into the fileset
        for (final ArtifactDownloadReport artifactDownloadReport : artifactDownloadReports) {
            if (artifactDownloadReport.getLocalFile() == null) {
                continue;
            }
            final NameEntry ne = fileset.createInclude();
            ne.setName(getPath(baseDir, artifactDownloadReport.getLocalFile()));
        }
        getProject().addReference(setid, fileset);
    } catch (Exception ex) {
        throw new BuildException("impossible to build ivy cache fileset: " + ex, ex);
    }
}
 
開發者ID:apache,項目名稱:ant-ivy,代碼行數:33,代碼來源:IvyCacheFileset.java


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