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


Java DirectoryFileFilter类代码示例

本文整理汇总了Java中org.apache.commons.io.filefilter.DirectoryFileFilter的典型用法代码示例。如果您正苦于以下问题:Java DirectoryFileFilter类的具体用法?Java DirectoryFileFilter怎么用?Java DirectoryFileFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: processResultsDirectory

import org.apache.commons.io.filefilter.DirectoryFileFilter; //导入依赖的package包/类
public void processResultsDirectory(String dirName) {
	File root = new File(dirName);
	try {
		Collection<File> files = FileUtils.listFiles(root,
				new RegexFileFilter(jmeterJTLFileName),
				DirectoryFileFilter.DIRECTORY);

		for (Iterator<File> iterator = files.iterator(); iterator.hasNext();) {
			File file = (File) iterator.next();
			parse(file);
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:WillemJiang,项目名称:acmeair,代码行数:16,代码来源:JmeterJTLParser.java

示例2: getResourceDomains

import org.apache.commons.io.filefilter.DirectoryFileFilter; //导入依赖的package包/类
public Set<String> getResourceDomains()
{
    Set<String> set = Sets.<String>newHashSet();
    File file1 = new File(this.resourcePackFile, "assets/");

    if (file1.isDirectory())
    {
        for (File file2 : file1.listFiles((FileFilter)DirectoryFileFilter.DIRECTORY))
        {
            String s = getRelativeName(file1, file2);

            if (!s.equals(s.toLowerCase()))
            {
                this.logNameNotLowercase(s);
            }
            else
            {
                set.add(s.substring(0, s.length() - 1));
            }
        }
    }

    return set;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:25,代码来源:FolderResourcePack.java

示例3: removeUselessPages

import org.apache.commons.io.filefilter.DirectoryFileFilter; //导入依赖的package包/类
private void removeUselessPages(ApplicationComponent application) {
	if (application != null) {
		File ionicPagesDir = new File(ionicWorkDir,"src/pages");
		List<String> pageDirectories = new ArrayList<String>();
		pageDirectories.add(ionicPagesDir.getAbsolutePath());
		
		List<PageComponent> pages = application.getPageComponentList();
		for (PageComponent page : pages) {
			File pageDir = new File(ionicPagesDir, page.getName());
			pageDirectories.add(pageDir.getAbsolutePath());
		}
		for (File dir: FileUtils.listFilesAndDirs(ionicPagesDir, FalseFileFilter.INSTANCE, DirectoryFileFilter.DIRECTORY)) {
			if (!pageDirectories.contains(dir.getAbsolutePath())) {
				try {
					FileUtils.deleteDirectory(dir);
				}
				catch(Exception e) {}
			}
		}
	}
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:22,代码来源:MobileBuilder.java

示例4: getRequiredExtensionNames

import org.apache.commons.io.filefilter.DirectoryFileFilter; //导入依赖的package包/类
@NotNull
@Override
public Set<String> getRequiredExtensionNames() {
    final File extDirectory = new File(this.getRootDirectory(), HybrisConstants.PLATFORM_EXTENSIONS_DIRECTORY_NAME);

    final Set<String> platformDependencies = Sets.newHashSet();

    if (extDirectory.isDirectory()) {
        final File[] files = extDirectory.listFiles((FileFilter) DirectoryFileFilter.DIRECTORY);

        if (null != files) {
            for (File file : files) {
                platformDependencies.add(file.getName());
            }
        }
    }

    return Collections.unmodifiableSet(platformDependencies);
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:20,代码来源:PlatformHybrisModuleDescriptor.java

示例5: loadSharedConfigurationFromDisk

import org.apache.commons.io.filefilter.DirectoryFileFilter; //导入依赖的package包/类
/**
 * Loads the internal region with the configuration in the configDirPath
 */
public void loadSharedConfigurationFromDisk() throws Exception {
  lockSharedConfiguration();
  File[] groupNames =
      new File(configDirPath).listFiles((FileFilter) DirectoryFileFilter.INSTANCE);
  Map<String, Configuration> sharedConfiguration = new HashMap<String, Configuration>();

  try {
    for (File groupName : groupNames) {
      Configuration configuration = readConfiguration(groupName);
      sharedConfiguration.put(groupName.getName(), configuration);
    }
    Region clusterRegion = getConfigurationRegion();
    clusterRegion.clear();
    clusterRegion.putAll(sharedConfiguration);

    // Overwrite the security settings using the locator's properties, ignoring whatever
    // in the import
    persistSecuritySettings(clusterRegion);

  } finally {
    unlockSharedConfiguration();
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:27,代码来源:ClusterConfigurationService.java

示例6: getResourceDomains

import org.apache.commons.io.filefilter.DirectoryFileFilter; //导入依赖的package包/类
public Set<String> getResourceDomains()
{
    Set<String> set = Sets.<String>newHashSet();
    File file1 = new File(this.resourcePackFile, "assets/");

    if (file1.isDirectory())
    {
        for (File file2 : file1.listFiles((FileFilter)DirectoryFileFilter.DIRECTORY))
        {
            String s = getRelativeName(file1, file2);

            if (s.equals(s.toLowerCase(java.util.Locale.ROOT)))
            {
                set.add(s.substring(0, s.length() - 1));
            }
            else
            {
                this.logNameNotLowercase(s);
            }
        }
    }

    return set;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:FolderResourcePack.java

示例7: getResourceDomains

import org.apache.commons.io.filefilter.DirectoryFileFilter; //导入依赖的package包/类
public Set<String> getResourceDomains()
{
    Set<String> set = Sets.<String>newHashSet();
    File file1 = new File(this.resourcePackFile, "assets/");

    if (file1.isDirectory())
    {
        for (File file2 : file1.listFiles((FileFilter)DirectoryFileFilter.DIRECTORY))
        {
            String s = getRelativeName(file1, file2);

            if (s.equals(s.toLowerCase()))
            {
                set.add(s.substring(0, s.length() - 1));
            }
            else
            {
                this.logNameNotLowercase(s);
            }
        }
    }

    return set;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:FolderResourcePack.java

示例8: getLocalAlbums

import org.apache.commons.io.filefilter.DirectoryFileFilter; //导入依赖的package包/类
private List<File> getLocalAlbums() {
    final String musicDirectory = AppConfiguration.getConfigurationProperty("music.dir");

    final File directory = new File(musicDirectory);
    if (!directory.exists()) {
        return Collections.emptyList();
    }

    return FileUtils.listFilesAndDirs(directory,
            DirectoryFileFilter.DIRECTORY,
            TrueFileFilter.INSTANCE)
            .stream()
            .filter(file -> !file.getAbsolutePath().equals(musicDirectory))
            .sorted(Comparator.comparing(File::getAbsolutePath))
            .collect(Collectors.toList());
}
 
开发者ID:adelolmo,项目名称:musicdroid,代码行数:17,代码来源:AppPresenter.java

示例9: listRootDirs

import org.apache.commons.io.filefilter.DirectoryFileFilter; //导入依赖的package包/类
/**
 * Get list of all existing root sub directories
 *
 * @param rootDir
 *          - the root directory to list
 * @return list of sub directories
 */
public static Collection<File> listRootDirs(final File rootDir) {
  final Collection<File> dirList = new ArrayList<File>();

  for (final File dir : FileUtils.listFilesAndDirs(rootDir, FalseFileFilter.INSTANCE,
      DirectoryFileFilter.INSTANCE)) {

    LOG.debug("Dir: {}", dir);

    // get only root directories
    final String name = getTemplateName(rootDir, dir);

    if (StringUtils.isNotBlank(name) && !name.contains("/")) {
      dirList.add(dir);
    }
  }
  return dirList;
}
 
开发者ID:headwirecom,项目名称:aemdc,代码行数:25,代码来源:FilesDirsUtil.java

示例10: findGitRepos

import org.apache.commons.io.filefilter.DirectoryFileFilter; //导入依赖的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

示例11: getDirectoryContents

import org.apache.commons.io.filefilter.DirectoryFileFilter; //导入依赖的package包/类
public List<File> getDirectoryContents(final String path) {
    final String rootPath = APPLICATION_PAGES_PATH + ("/".equals(path) ? "" : path);
    final File rootDir = new File(context.getRealPath(rootPath));
    final List<File> allDirectories = Arrays.asList(rootDir.listFiles((FileFilter) DirectoryFileFilter.DIRECTORY));
    final List<File> filteredDirectories = new ArrayList<File>();
    for (final File currentFile : allDirectories) {
        final String fullPath = path + currentFile.getName() + "/";
        if (!EXCLUDED_DIRS.contains(fullPath)) {
            filteredDirectories.add(currentFile);
        }
    }
    final List<File> files = Arrays.asList(rootDir.listFiles(CustomizedFile.Type.APPLICATION_PAGE.getFilter()));
    Collections.sort(filteredDirectories);
    Collections.sort(files);
    final List<File> filesAndDirs = new ArrayList<File>();
    filesAndDirs.addAll(filteredDirectories);
    filesAndDirs.addAll(files);
    return filesAndDirs;
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:20,代码来源:CustomizationHelper.java

示例12: moveToUpload

import org.apache.commons.io.filefilter.DirectoryFileFilter; //导入依赖的package包/类
public int moveToUpload() throws IOException {
	// put language extensions into array
	String[] extensions = new String[languages.size()];
	for (int i = 0; i<languages.size(); i++) {
		extensions[i] = languages.get(i).getExtension();
	}
	// for each project, and for each student, collect all the files with extensions in all subdirectories
	for (File project : projectFolders) {
		File[] studentFolders = new File(project.getPath()).listFiles((FilenameFilter) DirectoryFileFilter.DIRECTORY);
		for (File student : studentFolders) {
			// make a directory in the Upload folder
			String copyDirectory = uploadFolder + File.separator + prependClean(project.getName()) + File.separator + clean(student.getName());
			File studentDirUpload = new File(copyDirectory);
			// find all the files to copy there and copy them
			Collection<File> files = FileUtils.listFiles(student, extensions, true);
			for (File file:files){
				FileUtils.copyFileToDirectory(file,studentDirUpload);
			}
		}
	}
	return 1;
}
 
开发者ID:danainschool,项目名称:moss-taps,代码行数:23,代码来源:SeriesCollection.java

示例13: scanDir

import org.apache.commons.io.filefilter.DirectoryFileFilter; //导入依赖的package包/类
/**
 * Scan a directory for packages that match. This method is used prior to
 * finding a matching directory. Once the package names is matched
 * handleDir() is used.
 * 
 * @param classes
 *            The classes that have been found.
 * @param packageName
 *            The package name for classes to find.
 * @param dir
 *            The directory to scan.
 * @param cFilter
 *            The class acceptance filter.
 */
private static void scanDir(Set<String> classes, String packageName, File dir, ClassPathFilter cFilter) {
	if (!dir.exists()) {
		return;
	}
	if (dir.isDirectory()) {
		if (dir.getPath().endsWith(packageName.replace('.', '/'))) {
			// we have a match
			handleDir(classes, packageName, dir, cFilter);
		} else {
			// no match check next level
			for (File file : dir.listFiles((FileFilter) new AndFileFilter(DirectoryFileFilter.DIRECTORY,
					new NotFileFilter(new PrefixFileFilter("."))))) {
				scanDir(classes, packageName, file, cFilter);
			}
		}
	}
	// if it is not a directory we don't process it here as we are looking
	// for directories that start with the packageName.
}
 
开发者ID:Claudenw,项目名称:classpath-utils,代码行数:34,代码来源:ClassPathUtils.java

示例14: initWebApps

import org.apache.commons.io.filefilter.DirectoryFileFilter; //导入依赖的package包/类
private void initWebApps() throws Exception {
  File webAppsDir = new File(homeDir, "webapps");    
  File[] dirs = webAppsDir.listFiles((FileFilter) DirectoryFileFilter.DIRECTORY);
  for (File dir : dirs) {
    File[] webAppFiles = dir.listFiles((FilenameFilter) new NameFileFilter("webapp.xml"));
    if (webAppFiles.length == 0) {
      continue;
    }
    File file = webAppFiles[0];
    try {       
      WebApp webApp = new WebApp(webAppFiles[0]);
      webApps.put(webApp.getName(), webApp);  
      webApp.open();
    } catch (Exception e) {
      logger.error(String.format("Error creating webapp \"%s\"", file.getAbsolutePath()), e);
    }
  }    
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:19,代码来源:Context.java

示例15: cleanupIncrementalBackupDirectory

import org.apache.commons.io.filefilter.DirectoryFileFilter; //导入依赖的package包/类
private void cleanupIncrementalBackupDirectory(FolderInfo sourceFolder, List<ItemInfo> currentFolderChildren,
        File targetDir) {

    //Metadata File filter
    IOFileFilter metadataFilter = new MetadataFileFilter();

    //List all artifacts
    Collection<File> artifacts = Sets.newHashSet(
            targetDir.listFiles((FileFilter) new NotFileFilter(metadataFilter)));
    cleanArtifacts(currentFolderChildren, artifacts);

    //List all sub-target metadata
    Collection<File> subTargetMetadataFiles = FileUtils.listFiles(targetDir, metadataFilter,
            DirectoryFileFilter.INSTANCE);
    cleanMetadata(currentFolderChildren, subTargetMetadataFiles);

    //List all target metadata
    File targetDirMetadataContainerFolder = getMetadataContainerFolder(targetDir);
    Collection<File> targetMetadataFiles = FileUtils.listFiles(targetDirMetadataContainerFolder, metadataFilter,
            DirectoryFileFilter.INSTANCE);
    cleanTargetMetadata(sourceFolder, targetMetadataFiles);
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:23,代码来源:DbRepoExportHandler.java


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