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


Java DirectoryScanner.getIncludedFiles方法代碼示例

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


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

示例1: execute

import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
@Override
public void execute() throws BuildException {
    BasicStyleCheckerEngine engine = new BasicStyleCheckerEngine();
    
    try {
        for (FileSet fileset: filesets) {
            final DirectoryScanner scanner =
                    fileset.getDirectoryScanner(getProject());
            
            for (String filename: scanner.getIncludedFiles()) {
                final File file =
                        new File(fileset.getDir(getProject()), filename);
                
                System.out.println(file.getCanonicalPath());
                engine.check(file);
            }
        }
    } catch (IOException e) {
        throw new BuildException(e);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:BasicStyleCheckerTask.java

示例2: execute

import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
@Override
public void execute() throws BuildException {
	log( "Starting Hibernate EnhancementTask execution", Project.MSG_INFO );

	// we use the CtClass stuff here just as a simple vehicle for obtaining low level information about
	// the class(es) contained in a file while still maintaining easy access to the underlying byte[]
	final Project project = getProject();

	for ( FileSet fileSet : filesets ) {
		final File fileSetBaseDir = fileSet.getDir( project );
		final DirectoryScanner directoryScanner = fileSet.getDirectoryScanner( project );
		for ( String relativeIncludedFileName : directoryScanner.getIncludedFiles() ) {
			final File javaClassFile = new File( fileSetBaseDir, relativeIncludedFileName );
			if ( ! javaClassFile.exists() ) {
				continue;
			}

			processClassFile( javaClassFile);
		}
	}

}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:23,代碼來源:EnhancementTask.java

示例3: execute

import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
/**
 * Invoke the Hadoop record compiler on each record definition file
 */
@Override
public void execute() throws BuildException {
  if (src == null && filesets.size()==0) {
    throw new BuildException("There must be a file attribute or a fileset child element");
  }
  if (src != null) {
    doCompile(src);
  }
  Project myProject = getProject();
  for (int i = 0; i < filesets.size(); i++) {
    FileSet fs = filesets.get(i);
    DirectoryScanner ds = fs.getDirectoryScanner(myProject);
    File dir = fs.getDir(myProject);
    String[] srcs = ds.getIncludedFiles();
    for (int j = 0; j < srcs.length; j++) {
      doCompile(new File(dir, srcs[j]));
    }
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:23,代碼來源:RccTask.java

示例4: scanForFiles

import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
private static void scanForFiles(Collection<File> destination, String pathAndMask) {
    DirectoryScanner scanner = new DirectoryScanner();
    scanner.setCaseSensitive(false);

    String pathPart = FilenameUtils.getFullPath(pathAndMask);
    if(StringUtils.isEmpty(pathPart))
    {
        scanner.setBasedir(Paths.get(".").toAbsolutePath().normalize().toFile());
        scanner.setIncludes(new String[]{pathAndMask});
    }
    else
    {
        scanner.setBasedir(new File(pathPart));
        scanner.setIncludes(new String[]{FilenameUtils.getName(pathAndMask)});
    }

    scanner.scan();
    for (String file : scanner.getIncludedFiles()) {
        destination.add(new File(scanner.getBasedir(),file));
    }
}
 
開發者ID:BigBrassBand,項目名稱:remittanceparse,代碼行數:22,代碼來源:Main.java

示例5: collect

import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
/**
 * Collects all files from the supplied FileSet.
 * 
 * @param receiver    The Collection to receive the files (and implied directories). Not <code>null</code>.
 * @param unmanaged   The Collection to receive unmanaged directories. Not <code>null</code>.
 * @param fileset     The FileSet which has to be traversed. Not <code>null</code>.
 */
private void collect( List<File> receiver, List<File> unmanaged, FileSet fileset ) {
    
    DirectoryScanner scanner = fileset.getDirectoryScanner( getProject() );
    File             dir     = fileset.getDir( getProject() );
    
    
    if( incfiledirs ) {
        // we're including directories which are implied by the FileSet
        String[] dirs   = scanner.getIncludedDirectories();
        for( String includeddir : dirs ) {
            File directory = new File( dir, includeddir );
            collectUnmanaged( unmanaged, dir, directory, false );
            receiver.add( directory );
        }
    }
    
    String[]         files   = scanner.getIncludedFiles();
    for( String includedfile : files ) {
        File file = new File( dir, includedfile );
        collectUnmanaged( unmanaged, dir, file.getParentFile(), false );
        receiver.add( file );
    }
}
 
開發者ID:subclipse,項目名稱:svnant,代碼行數:31,代碼來源:ResourceSetSvnCommand.java

示例6: getInputFiles

import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
/**
 * Returns the list of input files ({@link java.io.File} objects) to process.
 * Note that this does not check that the file is a valid and useful XML file.
 * 
 * @return The input files
 */
private List getInputFiles()
{
	ArrayList result = new ArrayList();

    for (Iterator it = _fileSets.iterator(); it.hasNext();)
    {
        FileSet          fileSet    = (FileSet)it.next();
        File             fileSetDir = fileSet.getDir(getProject());
        DirectoryScanner scanner    = fileSet.getDirectoryScanner(getProject());
        String[]         files      = scanner.getIncludedFiles();

        for (int idx = 0; (files != null) && (idx < files.length); idx++)
        {
        	File file = new File(fileSetDir, files[idx]);

            if (file.isFile() && file.canRead())
            {
            	result.add(file);
            }
        }
    }
    return result;
}
 
開發者ID:gemxd,項目名稱:gemfirexd-oss,代碼行數:30,代碼來源:TestSummaryCreatorTask.java

示例7: isIncluded

import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
/**
 * Checks if passed file is scanned by any of the directory scanners.
 * 
 * @param pathToFile a fully qualified path to tested file.
 * @return true if so, false otherwise.
 */
public boolean isIncluded(String pathToFile)
{
    Iterator scanners = directoryScanners.iterator();
    while (scanners.hasNext())
    {
        DirectoryScanner scanner = (DirectoryScanner) scanners.next();
        scanner.scan();
        String[] includedFiles = scanner.getIncludedFiles();

        for (int i = 0; i < includedFiles.length; i++)
        {
            File includedFile = new File(scanner.getBasedir(), includedFiles[i]);
            if (pathToFile.equalsIgnoreCase(includedFile.getAbsolutePath()))
            {
                return true;
            }
        }
    }

    return false;
}
 
開發者ID:iMartinezMateu,項目名稱:openbravo-pos,代碼行數:28,代碼來源:FileMatchingConfiguration.java

示例8: listFiles

import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
@Override
public List<File> listFiles(final String mask) {
    try {
        DirectoryScanner scanner = new DirectoryScanner();
        scanner.setIncludes(new String[]{mask});
        scanner.setBasedir(this.basedir.replace("\\", "/"));
        scanner.setCaseSensitive(false);
        scanner.scan();
        String[] files = scanner.getIncludedFiles();
        List<File> result = new ArrayList<>();
        for (String file : files) {
            result.add(
                    new SimpleFile(file,
                            FileUtils.readFileToByteArray(new java.io.File(basedir + "/" + file))));
        }
        return result;
    } catch (IOException exception) {
        throw new BootException(exception);
    }
}
 
開發者ID:sql-boot,項目名稱:sql-boot,代碼行數:21,代碼來源:LocalFileSystem.java

示例9: processFileSet

import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
private void processFileSet(final FileSet fileSet) throws IOException {
  final DirectoryScanner scanner = fileSet.getDirectoryScanner(getProject());
  final String[] files = scanner.getIncludedFiles();
  String base = fileSet.getDir(getProject()).getCanonicalPath() + "\\";
  for (String file : files) {
    String lastDir = "";
    getDirFileList(lastDir);
    int idx = -1;
    do {
      idx = file.indexOf('\\', idx + 1);
      if (idx == -1) break;
      lastDir = file.substring(0, idx);
      getDirFileList(lastDir);
    }
    while (true);

    List<String> fileList = getDirFileList(lastDir);
    final String absolute = base + file;
    fileList.add(absolute);
    myAbsoluteToRelative.put(absolute, file);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:NsiFiles.java

示例10: execute

import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
/**
 * Invoke the Hadoop record compiler on each record definition file
 */
public void execute() throws BuildException {
  if (src == null && filesets.size()==0) {
    throw new BuildException("There must be a file attribute or a fileset child element");
  }
  if (src != null) {
    doCompile(src);
  }
  Project myProject = getProject();
  for (int i = 0; i < filesets.size(); i++) {
    FileSet fs = filesets.get(i);
    DirectoryScanner ds = fs.getDirectoryScanner(myProject);
    File dir = fs.getDir(myProject);
    String[] srcs = ds.getIncludedFiles();
    for (int j = 0; j < srcs.length; j++) {
      doCompile(new File(dir, srcs[j]));
    }
  }
}
 
開發者ID:rhli,項目名稱:hadoop-EAR,代碼行數:22,代碼來源:RccTask.java

示例11: getSourceBundleFiles

import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
protected List<SourceBundleFile> getSourceBundleFiles(BundleSet bundleSet) {
    List<SourceBundleFile> bundleFiles = new LinkedList<SourceBundleFile>();

    ResourceType type = bundleSet.getType();
    FileSet fs = bundleSet.getSourceFiles();
    DirectoryScanner ds = fs.getDirectoryScanner(getProject());
    String[] includedFiles = ds.getIncludedFiles();
    File base  = ds.getBasedir();
    for (int i = 0; i < includedFiles.length; i++) {
        File bundleFile = new File(base, includedFiles[i]);
        bundleFiles.add(
                new SourceBundleFile(type, pathToBundleId(type, includedFiles[i]),
                        bundleFile, includedFiles[i]));
    }
    return bundleFiles;
}
 
開發者ID:IBM-Cloud,項目名稱:gp-java-tools,代碼行數:17,代碼來源:GPBaseTask.java

示例12: execute

import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
public void execute() throws BuildException {
	if ( isExtended() ) {
		collectClassNames();
	}
	logger.info( "starting instrumentation" );
	Project project = getProject();
	Iterator filesets = filesets();
	while ( filesets.hasNext() ) {
		FileSet fs = ( FileSet ) filesets.next();
		DirectoryScanner ds = fs.getDirectoryScanner( project );
		String[] includedFiles = ds.getIncludedFiles();
		File d = fs.getDir( project );
		for ( int i = 0; i < includedFiles.length; ++i ) {
			File file = new File( d, includedFiles[i] );
			try {
				processFile( file );
			}
			catch ( Exception e ) {
				throw new BuildException( e );
			}
		}
	}
}
 
開發者ID:cacheonix,項目名稱:cacheonix-core,代碼行數:24,代碼來源:BasicInstrumentationTask.java

示例13: verifyPathAdheresToDesign

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

示例14: getFiles

import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
private String[] getFiles() {

		List files = new LinkedList();
		for ( Iterator i = fileSets.iterator(); i.hasNext(); ) {

			FileSet fs = (FileSet) i.next();
			DirectoryScanner ds = fs.getDirectoryScanner( getProject() );

			String[] dsFiles = ds.getIncludedFiles();
			for (int j = 0; j < dsFiles.length; j++) {
				File f = new File(dsFiles[j]);
				if ( !f.isFile() ) {
					f = new File( ds.getBasedir(), dsFiles[j] );
				}

				files.add( f.getAbsolutePath() );
			}
		}

		return ArrayHelper.toStringArray(files);
	}
 
開發者ID:cacheonix,項目名稱:cacheonix-core,代碼行數:22,代碼來源:SchemaExportTask.java

示例15: execute

import org.apache.tools.ant.DirectoryScanner; //導入方法依賴的package包/類
/**
 * ants execute method.
 */
@Override
public void execute() {
	try {
		for (final FileSet fileset : filesets) {
			final DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
			final String[] includedFiles = ds.getIncludedFiles();
			for (final String filename : includedFiles) {
				System.out.println(ds.getBasedir().getAbsolutePath() + File.separator + filename);
				convert(ds.getBasedir().getAbsolutePath() + File.separator + filename);
			}
		}
	} catch (final Exception e) {
		throw new BuildException(e);
	}
}
 
開發者ID:arianne,項目名稱:stendhal,代碼行數:19,代碼來源:MapRenderer.java


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