當前位置: 首頁>>代碼示例>>Java>>正文


Java FileFilterUtils.makeDirectoryOnly方法代碼示例

本文整理匯總了Java中org.apache.commons.io.filefilter.FileFilterUtils.makeDirectoryOnly方法的典型用法代碼示例。如果您正苦於以下問題:Java FileFilterUtils.makeDirectoryOnly方法的具體用法?Java FileFilterUtils.makeDirectoryOnly怎麽用?Java FileFilterUtils.makeDirectoryOnly使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.io.filefilter.FileFilterUtils的用法示例。


在下文中一共展示了FileFilterUtils.makeDirectoryOnly方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

import org.apache.commons.io.filefilter.FileFilterUtils; //導入方法依賴的package包/類
@Override
public void run() {
    try {
        if(!shutdown.get()) {
            LOGGER.info("Actively cleaning up directories older than " + TimeUnit.MILLISECONDS.toHours(cleanupAgeMillis) + " hours");
            final IOFileFilter olderThanFilter = FileFilterUtils.asFileFilter(olderThanFileFilter(cleanupAgeMillis));
            final IOFileFilter tempDirFilter =
                FileFilterUtils.prefixFileFilter(prefix);

            /**
             * Delete directories that are:
             * older than [clean up age millis]
             * starts with temp-dir-prefix
             */
            final IOFileFilter deleteAfterMillisFilter = FileFilterUtils.makeDirectoryOnly(
                FileFilterUtils.andFileFilter(olderThanFilter, tempDirFilter)
            );
            deleteUserDirectories(rootDirectory, deleteAfterMillisFilter);
        } else {
            LOGGER.info("Currently shutdown, skipping older-than directory cleanup");
        }
    } catch (Exception e) {
        LOGGER.error("Unhandled Exception during directory cleanup", e);
    }
}
 
開發者ID:indeedeng,項目名稱:proctor,代碼行數:26,代碼來源:SvnWorkspaceProviderImpl.java

示例2: DirectoryWalker

import org.apache.commons.io.filefilter.FileFilterUtils; //導入方法依賴的package包/類
/**
 * Construct an instance with a directory and a file filter and an optional
 * limit on the <i>depth</i> navigated to.
 * <p>
 * The filters control which files and directories will be navigated to as part
 * of the walk. This constructor uses {@link FileFilterUtils#makeDirectoryOnly(IOFileFilter)}
 * and {@link FileFilterUtils#makeFileOnly(IOFileFilter)} internally to combine the filters.
 * A <code>null</code> filter means that no filtering should occur.
 *
 * @param directoryFilter  the filter to apply to directories, null means visit all directories
 * @param fileFilter  the filter to apply to files, null means visit all files
 * @param depthLimit  controls how <i>deep</i> the hierarchy is
 *  navigated to (less than 0 means unlimited)
 */
protected DirectoryWalker(IOFileFilter directoryFilter, IOFileFilter fileFilter, int depthLimit) {
    if (directoryFilter == null && fileFilter == null) {
        this.filter = null;
    } else {
        directoryFilter = (directoryFilter != null ? directoryFilter : TrueFileFilter.TRUE);
        fileFilter = (fileFilter != null ? fileFilter : TrueFileFilter.TRUE);
        directoryFilter = FileFilterUtils.makeDirectoryOnly(directoryFilter);
        fileFilter = FileFilterUtils.makeFileOnly(fileFilter);
        this.filter = FileFilterUtils.or(directoryFilter, fileFilter);
    }
    this.depthLimit = depthLimit;
}
 
開發者ID:fesch,項目名稱:Moenagade,代碼行數:27,代碼來源:DirectoryWalker.java

示例3: DirectoryWalker

import org.apache.commons.io.filefilter.FileFilterUtils; //導入方法依賴的package包/類
/**
 * Construct an instance with a directory and a file filter and an optional
 * limit on the <i>depth</i> navigated to.
 * <p>
 * The filters control which files and directories will be navigated to as part
 * of the walk. This constructor uses {@link FileFilterUtils#makeDirectoryOnly(IOFileFilter)}
 * and {@link FileFilterUtils#makeFileOnly(IOFileFilter)} internally to combine the filters.
 * A {@code null} filter means that no filtering should occur.
 *
 * @param directoryFilter  the filter to apply to directories, null means visit all directories
 * @param fileFilter  the filter to apply to files, null means visit all files
 * @param depthLimit  controls how <i>deep</i> the hierarchy is
 *  navigated to (less than 0 means unlimited)
 */
protected DirectoryWalker(IOFileFilter directoryFilter, IOFileFilter fileFilter, int depthLimit) {
    if (directoryFilter == null && fileFilter == null) {
        this.filter = null;
    } else {
        directoryFilter = directoryFilter != null ? directoryFilter : TrueFileFilter.TRUE;
        fileFilter = fileFilter != null ? fileFilter : TrueFileFilter.TRUE;
        directoryFilter = FileFilterUtils.makeDirectoryOnly(directoryFilter);
        fileFilter = FileFilterUtils.makeFileOnly(fileFilter);
        this.filter = FileFilterUtils.or(directoryFilter, fileFilter);
    }
    this.depthLimit = depthLimit;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:27,代碼來源:DirectoryWalker.java

示例4: DirectoryWalker

import org.apache.commons.io.filefilter.FileFilterUtils; //導入方法依賴的package包/類
/**
 * Construct an instance with a directory and a file filter and an optional
 * limit on the <i>depth</i> navigated to.
 * <p>
 * The filters control which files and directories will be navigated to as part
 * of the walk. This constructor uses {@link FileFilterUtils#makeDirectoryOnly(IOFileFilter)}
 * and {@link FileFilterUtils#makeFileOnly(IOFileFilter)} internally to combine the filters.
 * A {@code null} filter means that no filtering should occur.
 *
 * @param directoryFilter  the filter to apply to directories, null means visit all directories
 * @param fileFilter  the filter to apply to files, null means visit all files
 * @param depthLimit  controls how <i>deep</i> the hierarchy is
 *  navigated to (less than 0 means unlimited)
 */
protected DirectoryWalker(IOFileFilter directoryFilter, IOFileFilter fileFilter, final int depthLimit) {
    if (directoryFilter == null && fileFilter == null) {
        this.filter = null;
    } else {
        directoryFilter = directoryFilter != null ? directoryFilter : TrueFileFilter.TRUE;
        fileFilter = fileFilter != null ? fileFilter : TrueFileFilter.TRUE;
        directoryFilter = FileFilterUtils.makeDirectoryOnly(directoryFilter);
        fileFilter = FileFilterUtils.makeFileOnly(fileFilter);
        this.filter = FileFilterUtils.or(directoryFilter, fileFilter);
    }
    this.depthLimit = depthLimit;
}
 
開發者ID:PuppyRush,項目名稱:WidgetStore,代碼行數:27,代碼來源:DirectoryWalker.java

示例5: listRecursively

import org.apache.commons.io.filefilter.FileFilterUtils; //導入方法依賴的package包/類
/**
 * On contrary to
 * {@link org.apache.commons.io.FileUtils#listFiles(File, IOFileFilter, IOFileFilter)} and
 * {@link org.apache.commons.io.FileUtils#listFilesAndDirs(File, IOFileFilter, IOFileFilter)}
 * , this method returns sub-directories if and only if {@code resultsFilter} allows it.
 * 
 * @param resultsFilter
 *            Filter for returned files.
 * @param recurseFilter
 *            Filter for recursion into sub-directories. Will be made
 *            {@link FileFilterUtils#makeDirectoryOnly(IOFileFilter)
 *            directory only} before use.
 */
public static Collection<File> listRecursively(File directory, IOFileFilter resultsFilter, IOFileFilter recurseFilter) {
	Collection<File> results = Lists.newLinkedList();
	
	IOFileFilter effectiveRecurseFilter = FileFilterUtils.makeDirectoryOnly(recurseFilter);
	innerListRecursively(results, directory, resultsFilter, effectiveRecurseFilter);
	
	return results;
}
 
開發者ID:openwide-java,項目名稱:owsi-core-parent,代碼行數:22,代碼來源:FileUtils.java


注:本文中的org.apache.commons.io.filefilter.FileFilterUtils.makeDirectoryOnly方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。