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


Java FileSet.setupDirectoryScanner方法代碼示例

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


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

示例1: processExtraClassPathFileSets

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
private void processExtraClassPathFileSets() throws BuildException {

		for (Iterator jarIter = mExtraClassPathFileSets.iterator(); jarIter
				.hasNext();) {
			FileSet fs = (FileSet) jarIter.next();
			Project p = fs.getProject();
			File srcDir = fs.getDir(p);
			FileScanner ds = fs.getDirectoryScanner(p);
			fs.setupDirectoryScanner(ds, p);
			ds.scan();

			String[] files = ds.getIncludedFiles();

			for (int i = 0; i < files.length; i++) {
				File f = new File(srcDir, files[i]);
				String path = f.getPath().replace(File.separatorChar, '/');
				bundleProperties.addToExtraClassPath(path);
			}
		}
	}
 
開發者ID:UltraMixer,項目名稱:JarBundler,代碼行數:21,代碼來源:JarBundler.java

示例2: processJarFileSets

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
private void processJarFileSets() throws BuildException {

		for (Iterator jarIter = mJarFileSets.iterator(); jarIter.hasNext();) {

			FileSet fs = (FileSet) jarIter.next();

			Project p = fs.getProject();
			File srcDir = fs.getDir(p);
			FileScanner ds = fs.getDirectoryScanner(p);
			fs.setupDirectoryScanner(ds, p);
			ds.scan();

			String[] files = ds.getIncludedFiles();

			try {

				for (int i = 0; i < files.length; i++) {
					String fileName = files[i];
					File src = new File(srcDir, fileName);
					File dest = new File(mJavaDir, fileName);

					if (mVerbose)
						log("Copying JAR file to \"" + bundlePath(dest) + "\"");

					mFileUtils.copyFile(src, dest);
					bundleProperties.addToClassPath(fileName);
				}

			} catch (IOException ex) {
				throw new BuildException("Cannot copy jar file: " + ex);
			}
		}
	}
 
開發者ID:UltraMixer,項目名稱:JarBundler,代碼行數:34,代碼來源:JarBundler.java

示例3: processCopyingFileSets

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
private void processCopyingFileSets(List fileSets, File targetdir, boolean setExec) {
	for (Iterator execIter = fileSets.iterator(); execIter.hasNext();) {
		FileSet fs = (FileSet) execIter.next();
		Project p = fs.getProject();
		File srcDir = fs.getDir(p);
		FileScanner ds = fs.getDirectoryScanner(p);
		fs.setupDirectoryScanner(ds, p);
		ds.scan();

		String[] files = ds.getIncludedFiles();

		if (files.length == 0) {
			// this is probably an error -- warn about it
			System.err
					.println("WARNING: fileset for copying from directory "
							+ srcDir + ": no files found");
		} else {
			try {
				for (int i = 0; i < files.length; i++) {
					String fileName = files[i];
					File src = new File(srcDir, fileName);
					File dest = new File(targetdir, fileName);
					
					if (mVerbose) 
						log("Copying "
								+ (setExec ? "exec" : "resource")
								+ " file to \"" + bundlePath(dest) +"\"");
					
					mFileUtils.copyFile(src, dest);
					if (setExec)
						setExecutable(dest);
				}
			} catch (IOException ex) {
				throw new BuildException("Cannot copy file: " + ex);
			}
		}
	}
}
 
開發者ID:UltraMixer,項目名稱:JarBundler,代碼行數:39,代碼來源:JarBundler.java

示例4: processCopyingFileSets

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
private void processCopyingFileSets(List fileSets, File targetdir, boolean setExec) {

		for (Iterator execIter = fileSets.iterator(); execIter.hasNext();) {
			FileSet fs = (FileSet) execIter.next();
			Project p = fs.getProject();
			File srcDir = fs.getDir(p);
			FileScanner ds = fs.getDirectoryScanner(p);
			fs.setupDirectoryScanner(ds, p);
			ds.scan();

			String[] files = ds.getIncludedFiles();

			if (files.length == 0) {
				// this is probably an error -- warn about it
				System.err
						.println("WARNING: fileset for copying from directory "
								+ srcDir + ": no files found");
			} else {
				try {
					for (int i = 0; i < files.length; i++) {
						String fileName = files[i];
						File src = new File(srcDir, fileName);
						File dest = new File(targetdir, fileName);
						
						if (mVerbose) 
							log("Copying "
									+ (setExec ? "exec" : "resource")
									+ " file to \"" + bundlePath(dest) +"\"");
						
						mFileUtils.copyFile(src, dest);
						if (setExec)
							setExecutable(dest);
					}
				} catch (IOException ex) {
					throw new BuildException("Cannot copy file: " + ex);
				}
			}
		}
	}
 
開發者ID:tofi86,項目名稱:Jarbundler,代碼行數:40,代碼來源:JarBundler.java

示例5: loadLinks

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
 * Load links from properties files included in one or more FileSets.
 *
 * <p>This method is only invoked when the action attribute is set to
 * &quot;recreate&quot;. The filesets passed in are assumed to specify the
 * names of the property files with the link information and the
 * subdirectories in which to look for them.</p>
 *
 * @param fileSets    The <code>FileSet</code>s for this task.
 * @return            The links to be made.
 */
private Properties loadLinks(List<FileSet> fileSets) {
    Properties finalList = new Properties();
    // loop through the supplied file sets:
    for (FileSet fs : fileSets) {
        DirectoryScanner ds = new DirectoryScanner();
        fs.setupDirectoryScanner(ds, getProject());
        ds.setFollowSymlinks(false);
        ds.scan();
        File dir = fs.getDir(getProject());

        // load included files as properties files:
        for (String name : ds.getIncludedFiles()) {
            File inc = new File(dir, name);
            File pf = inc.getParentFile();
            Properties lnks = new Properties();
            try (InputStream is = new BufferedInputStream(
                Files.newInputStream(inc.toPath()))) {
                lnks.load(is);
                pf = pf.getCanonicalFile();
            } catch (FileNotFoundException fnfe) {
                handleError("Unable to find " + name + "; skipping it.");
                continue;
            } catch (IOException ioe) {
                handleError("Unable to open " + name
                    + " or its parent dir; skipping it.");
                continue;
            }
            try {
                lnks.store(new PrintStream(
                    new LogOutputStream(this, Project.MSG_INFO)),
                    "listing properties");
            } catch (IOException ex) {
                log("failed to log unshortened properties");
                lnks.list(new PrintStream(
                    new LogOutputStream(this, Project.MSG_INFO)));
            }
            // Write the contents to our master list of links
            // This method assumes that all links are defined in
            // terms of absolute paths, or paths relative to the
            // working directory:
            for (String key : lnks.stringPropertyNames()) {
                finalList.put(new File(pf, key).getAbsolutePath(),
                    lnks.getProperty(key));
            }
        }
    }
    return finalList;
}
 
開發者ID:apache,項目名稱:ant,代碼行數:60,代碼來源:Symlink.java


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