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


Java FalseFileFilter.INSTANCE属性代码示例

本文整理汇总了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;
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:54,代码来源:FileUtils.java

示例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;
}
 
开发者ID:rektide,项目名称:javamaildir,代码行数:52,代码来源:FileUtils.java

示例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);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:FileUtils.java

示例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);
}
 
开发者ID:PuppyRush,项目名称:WidgetStore,代码行数:10,代码来源:FileUtils.java


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