本文整理汇总了Java中org.apache.commons.io.filefilter.FalseFileFilter.INSTANCE属性的典型用法代码示例。如果您正苦于以下问题:Java FalseFileFilter.INSTANCE属性的具体用法?Java FalseFileFilter.INSTANCE怎么用?Java FalseFileFilter.INSTANCE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.io.filefilter.FalseFileFilter
的用法示例。
在下文中一共展示了FalseFileFilter.INSTANCE属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listFiles
/**
* 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;
}
示例2: listFiles
/**
* <p>Finds files within a given directory (and optionally its
* subdirectories). All files found are filtered by an IOFileFilter.
* </p>
* <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>
* <p>An example: If you want to search through all directories called
* "temp" you pass in <code>FileFilterUtils.NameFileFilter("temp")</code>
* </p>
* <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>.
* </p>
* @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 null, 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 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.andFileFilter(fileFilter,
FileFilterUtils.notFileFilter(DirectoryFileFilter.INSTANCE));
//Setup effective directory filter
IOFileFilter effDirFilter;
if (dirFilter == null) {
effDirFilter = FalseFileFilter.INSTANCE;
} else {
effDirFilter = FileFilterUtils.andFileFilter(dirFilter,
DirectoryFileFilter.INSTANCE);
}
//Find files
Collection files = new java.util.LinkedList();
innerListFiles(files, directory,
FileFilterUtils.orFileFilter(effFileFilter, effDirFilter));
return files;
}
示例3: setUpEffectiveDirFilter
/**
* Returns a filter that accepts directories in addition to the {@link File} objects accepted by the given filter.
*
* @param dirFilter a base filter to add to
* @return a filter that accepts directories
*/
private static IOFileFilter setUpEffectiveDirFilter(IOFileFilter dirFilter) {
return dirFilter == null ? FalseFileFilter.INSTANCE : FileFilterUtils.and(dirFilter,
DirectoryFileFilter.INSTANCE);
}
示例4: setUpEffectiveDirFilter
/**
* Returns a filter that accepts directories in addition to the {@link File} objects accepted by the given filter.
*
* @param dirFilter a base filter to add to
* @return a filter that accepts directories
*/
private static IOFileFilter setUpEffectiveDirFilter(final IOFileFilter dirFilter) {
return dirFilter == null ? FalseFileFilter.INSTANCE : FileFilterUtils.and(dirFilter,
DirectoryFileFilter.INSTANCE);
}