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


Java FileFilterUtils.and方法代码示例

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


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

示例1: findGitRepos

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
public static List<String> findGitRepos(String dirPath) {
	File dir = new File(dirPath);
	IOFileFilter gitDirFilter = (IOFileFilter) FileFilterUtils.suffixFileFilter(".git");
	IOFileFilter notFile = FileFilterUtils.notFileFilter(TrueFileFilter.INSTANCE);
	IOFileFilter compositeFilter = FileFilterUtils.and(notFile, gitDirFilter);
	
	List<File> files = (List<File>) FileUtils.listFilesAndDirs(dir,compositeFilter,DirectoryFileFilter.INSTANCE);
	List<String> results = new ArrayList<String>();
	for(File f: files) {
		try {
			if(!f.getCanonicalPath().endsWith("/.git"))
				continue;
			
			String gitStripped = f.getCanonicalPath().replace("/.git", "");
			System.out.println(gitStripped);
			results.add(gitStripped);
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	return results;
}
 
开发者ID:wsdookadr,项目名称:mdetect,代码行数:24,代码来源:FileScanUtils.java

示例2: activate

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
public synchronized void activate() throws MojoExecutionException
{   
  IOFileFilter logFilter = FileFilterUtils.and(
          FileFilterUtils.fileFileFilter(),
          FileFilterUtils.nameFileFilter(engineLog.getName()));
  FileAlterationObserver fileObserver = new FileAlterationObserver(engineLog.getParent(), logFilter);
  fileObserver.addListener(new LogModificationListener());
  monitor = new FileAlterationMonitor(100);
  monitor.addObserver(fileObserver);
  try
  {
    monitor.start();
  }
  catch (Exception ex)
  {
    throw new MojoExecutionException("Failed to activate deploy log forwarder", ex);
  }
}
 
开发者ID:axonivy,项目名称:project-build-plugin,代码行数:19,代码来源:FileLogForwarder.java

示例3: fileFilter

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
private IOFileFilter fileFilter() {
    IOFileFilter fileFileFilter = FileFilterUtils.fileFileFilter();
    IOFileFilter[] noes = new IOFileFilter[]{
        new RegexFileFilter(B + X + D + "class" + E),
        new RegexFileFilter(B + X + D + "db" + E),
        new RegexFileFilter(B + X + D + "ear" + E),
        new RegexFileFilter(B + X + D + "err" + E),
        new RegexFileFilter(B + X + D + "gif" + E),
        new RegexFileFilter(B + X + D + "jar" + E),
        new RegexFileFilter(B + X + D + "jpg" + E),
        new RegexFileFilter(B + X + D + "lnk" + E),
        new RegexFileFilter(B + X + D + "log" + E),
        new RegexFileFilter(B + X + D + "nbm" + E),
        new RegexFileFilter(B + X + D + "out" + E),
        new RegexFileFilter(B + X + D + "png" + E),
        new RegexFileFilter(B + X + D + "war" + E),
        new RegexFileFilter(B + X + D + "zip" + E)
    };
    IOFileFilter noesFileFilter = FileFilterUtils.notFileFilter(FileFilterUtils.or(noes));
    IOFileFilter filter = FileFilterUtils.and(fileFileFilter, noesFileFilter);
    return filter;
}
 
开发者ID:proyecto-adalid,项目名称:adalid,代码行数:23,代码来源:FileBrowser.java

示例4: listFiles

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
 * Finds files within a given directory (and optionally its
 * subdirectories). All files found are filtered by an IOFileFilter.
 * <p>
 * If your search should recurse into subdirectories you can pass in
 * an IOFileFilter for directories. You don't need to bind a
 * DirectoryFileFilter (via logical AND) to this filter. This method does
 * that for you.
 * <p>
 * An example: If you want to search through all directories called
 * "temp" you pass in <code>FileFilterUtils.NameFileFilter("temp")</code>
 * <p>
 * Another common usage of this method is find files in a directory
 * tree but ignoring the directories generated CVS. You can simply pass
 * in <code>FileFilterUtils.makeCVSAware(null)</code>.
 *
 * @param directory  the directory to search in
 * @param fileFilter  filter to apply when finding files.
 * @param dirFilter  optional filter to apply when finding subdirectories.
 * If this parameter is <code>null</code>, subdirectories will not be included in the
 * search. Use TrueFileFilter.INSTANCE to match all directories.
 * @return an collection of java.io.File with the matching files
 * @see org.apache.commons.io.filefilter.FileFilterUtils
 * @see org.apache.commons.io.filefilter.NameFileFilter
 */
public static Collection<File> listFiles(
        File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) {
    if (!directory.isDirectory()) {
        throw new IllegalArgumentException(
                "Parameter 'directory' is not a directory");
    }
    if (fileFilter == null) {
        throw new NullPointerException("Parameter 'fileFilter' is null");
    }

    //Setup effective file filter
    IOFileFilter effFileFilter = FileFilterUtils.and(fileFilter,
        FileFilterUtils.notFileFilter(DirectoryFileFilter.INSTANCE));

    //Setup effective directory filter
    IOFileFilter effDirFilter;
    if (dirFilter == null) {
        effDirFilter = FalseFileFilter.INSTANCE;
    } else {
        effDirFilter = FileFilterUtils.and(dirFilter,
            DirectoryFileFilter.INSTANCE);
    }

    //Find files
    Collection<File> files = new java.util.LinkedList<File>();
    innerListFiles(files, directory,
        FileFilterUtils.or(effFileFilter, effDirFilter));
    return files;
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:55,代码来源:FileUtils.java

示例5: monitor

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
public void monitor(String directory, int interval) {
    FileAlterationObserver fileAlterationObserver = new FileAlterationObserver(directory, FileFilterUtils.and(FileFilterUtils.nameFileFilter(SENSITIVE_WORD_FILE_NAME)), null);
    fileAlterationObserver.addListener(this);
    FileAlterationMonitor fileAlterationMonitor = new FileAlterationMonitor(interval, fileAlterationObserver);

    try {
        fileAlterationMonitor.start();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:xiaolongzuo,项目名称:everyone-java-blog,代码行数:12,代码来源:SensitiveWordMonitor.java

示例6: prepareLayoutFiles

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
 * This method is responsible to copy layout folder to destination directory and not copy template .html files
 * @param outputDir
 * @throws IOException
 */
private void prepareLayoutFiles(File outputDir) throws IOException {
    URL url = getClass().getResource("/layout");

    IOFileFilter notHtmlFilter = FileFilterUtils.notFileFilter(FileFilterUtils.suffixFileFilter(".html"));
    FileFilter filter = FileFilterUtils.and(notHtmlFilter);
    //cleanDirectory(outputDir,"/diagrams");
    //cleanDirectory(outputDir,"/tables");
    ResourceWriter.copyResources(url, outputDir, filter);
}
 
开发者ID:schemaspy,项目名称:schemaspy,代码行数:15,代码来源:SchemaAnalyzer.java

示例7: dirFilter

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
private IOFileFilter dirFilter() {
    IOFileFilter makeFileFilter = FileFilterUtils.makeCVSAware(FileFilterUtils.makeSVNAware(null));
    IOFileFilter metaFileFilter = new RegexPathFilter(B + X + S + "velocity" + S + "templates" + S + "meta" + S + X + E);
    IOFileFilter mesaFileFilter = FileFilterUtils.notFileFilter(metaFileFilter);
    IOFileFilter[] noes = new IOFileFilter[]{
        new RegexFileFilter(B + "build" + E),
        new RegexFileFilter(B + "dist" + E),
        new RegexFileFilter(B + "private" + E),
        new RegexFileFilter(B + "test" + E)
    };
    IOFileFilter noesFileFilter = FileFilterUtils.notFileFilter(FileFilterUtils.or(noes));
    IOFileFilter filter = FileFilterUtils.and(makeFileFilter, mesaFileFilter, noesFileFilter);
    return filter;
}
 
开发者ID:proyecto-adalid,项目名称:adalid,代码行数:15,代码来源:MetaFolderSql.java

示例8: dirFilter

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
private IOFileFilter dirFilter() {
    IOFileFilter makeCVSSVNAware = FileFilterUtils.makeCVSAware(FileFilterUtils.makeSVNAware(null));
    IOFileFilter[] noes = new IOFileFilter[]{
        new RegexFileFilter(B + X + D + "git" + E),
        new RegexFileFilter(B + "build" + E),
        new RegexFileFilter(B + "dist" + E),
        new RegexFileFilter(B + "target" + E)
    };
    IOFileFilter noesFileFilter = FileFilterUtils.notFileFilter(FileFilterUtils.or(noes));
    IOFileFilter filter = FileFilterUtils.and(makeCVSSVNAware, noesFileFilter);
    return filter;
}
 
开发者ID:proyecto-adalid,项目名称:adalid,代码行数:13,代码来源:FileBrowser.java

示例9: testParameterDefinitions

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
public static void testParameterDefinitions(String outputDirectory, String... excludeFiles)
    throws ClassNotFoundException {
  IOFileFilter includeFilter = new SuffixFileFilter(".java");

  if (excludeFiles != null) {
    IOFileFilter excludeFilter = FileFilterUtils.notFileFilter(new SuffixFileFilter(excludeFiles));
    includeFilter = FileFilterUtils.and(excludeFilter, includeFilter);
  }

  Iterator<File> files = org.apache.commons.io.FileUtils.iterateFiles(
      new File(outputDirectory),
      includeFilter,
      TrueFileFilter.INSTANCE);
  testParameterDefinitions(files);
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:16,代码来源:ParametersTestUtil.java

示例10: findTranscripts

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
protected Collection<File> findTranscripts(File dir, String filePattern) {
    IOFileFilter fileFilter = FileFilterUtils.suffixFileFilter(TRANSCRIPT_EXTENSION);

    if (StringUtils.isNotBlank(filePattern)) {
        fileFilter = FileFilterUtils.and(
                fileFilter,
                FileFilterUtils.nameFileFilter(filePattern));
    }

    //Get all XML files, no recursion
    return FileUtils.listFiles(dir,  fileFilter, null);
}
 
开发者ID:memphis-iis,项目名称:gluten,代码行数:13,代码来源:TranscriptService.java

示例11: extractPossibleDataFile

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
private static List<File> extractPossibleDataFile(File dwcFolder) {
  List<File> dataFiles = new ArrayList<>();
  for (String suffix : DATA_FILE_SUFFICES) {
    FileFilter ff = FileFilterUtils.and(
            FileFilterUtils.suffixFileFilter(suffix, IOCase.INSENSITIVE), HiddenFileFilter.VISIBLE
    );
    dataFiles.addAll(Arrays.asList(dwcFolder.listFiles(ff)));
  }
  return dataFiles;
}
 
开发者ID:gbif,项目名称:dwca-io,代码行数:11,代码来源:InternalDwcFileFactory.java

示例12: getModsFileFilter

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
 * Creates a filter that returns everything in the "mods" folder except
 * the specified cubes which are distributed with each new release and
 * any existing themes which are now found in the "themes" folder.
 */
private FileFilter getModsFileFilter() {
    final String[] excludedCubes = new String[]{
        "legacy_cube.txt", "modern_cube.txt", "standard_cube.txt", "extended_cube.txt", "ubeefx_cube.txt"
    };
    final IOFileFilter cubesFilter = new NameFileFilter(excludedCubes, IOCase.INSENSITIVE);
    final IOFileFilter excludeCubes = FileFilterUtils.notFileFilter(cubesFilter);
    final IOFileFilter excludeThemes = FileFilterUtils.notFileFilter(new WildcardFileFilter("*_theme*"));
    return FileFilterUtils.and(excludeCubes, excludeThemes);
}
 
开发者ID:magarena,项目名称:magarena,代码行数:15,代码来源:ImportWorker.java

示例13: getFolders

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
public List<String> getFolders()
    throws MojoExecutionException
{
    IOFileFilter folders = FileFilterUtils.and( HiddenFileFilter.VISIBLE, DirectoryFileFilter.DIRECTORY );
    IOFileFilter makeSVNAware = FileFilterUtils.makeSVNAware( folders );
    IOFileFilter makeCVSAware = FileFilterUtils.makeCVSAware( makeSVNAware );

    String[] list = folder.list( makeCVSAware );
    if ( list == null )
    {
        throw new MojoExecutionException( "The specified folder doesn't exist: " + folder );
    }

    List<File> listOfDirectories = new ArrayList<File>();
    for ( String item : list )
    {
        listOfDirectories.add( new File( folder, item ) );
    }

    Collections.sort( listOfDirectories, convertSortOrder() );
    List<String> resultList = new ArrayList<String>();
    for ( File file : listOfDirectories )
    {
        resultList.add( file.getName() );
    }
    return resultList;
}
 
开发者ID:khmarbaise,项目名称:iterator-maven-plugin,代码行数:28,代码来源:AbstractIteratorMojo.java

示例14: fileFilterForExtension

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
 * Setup an {@link IOFileFilter} that navigates recursively through
 * directories, returning files that match {@code extension}
 *
 * @param extension The extension (leading "." optional) to filter for
 * @return An instance of {@link IOFileFilter} to be used for a file system observer
 */
public static IOFileFilter fileFilterForExtension(String extension) {
    if (!extension.startsWith(".")) {
        extension = "." + extension;
    }
    IOFileFilter directories = defaultDirectoryFilter();
    IOFileFilter files       = FileFilterUtils.and(
            FileFilterUtils.fileFileFilter(),
            FileFilterUtils.suffixFileFilter(extension));
    return FileFilterUtils.or(directories, files);
}
 
开发者ID:semperos,项目名称:screwdriver,代码行数:18,代码来源:FileUtil.java

示例15: testFileFilterExclusions

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
@Test
public void testFileFilterExclusions() throws Exception {
    // exclude directories named "bootstrap"
    IOFileFilter dirFilter = FileFilterUtils.and(
            FileFilterUtils.notFileFilter(new NameFileFilter("bootstrap")),
            DirectoryFileFilter.DIRECTORY);
    cfg.setCssDirFilter(dirFilter);
    BuildAll.build(cfg);
    Collection<File> files = TestUtil.cssOutputFiles();
    assertEquals(2, files.size());
}
 
开发者ID:semperos,项目名称:screwdriver,代码行数:12,代码来源:ExcludesIntegrationTest.java


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