當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。