本文整理汇总了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();
}
}
示例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;
}
示例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) {}
}
}
}
}
示例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();
}
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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.
}
示例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);
}
}
}
示例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);
}