本文整理匯總了Java中org.apache.commons.io.filefilter.TrueFileFilter.TRUE屬性的典型用法代碼示例。如果您正苦於以下問題:Java TrueFileFilter.TRUE屬性的具體用法?Java TrueFileFilter.TRUE怎麽用?Java TrueFileFilter.TRUE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.commons.io.filefilter.TrueFileFilter
的用法示例。
在下文中一共展示了TrueFileFilter.TRUE屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: generateLegacyTorrent
public static Torrent generateLegacyTorrent(File source, final List<String> ignoreFilter, List<List<URI>> announceList, String createdBy)
throws InterruptedException, IOException, NoSuchAlgorithmException {
if (!source.isDirectory()) {
return Torrent.create(source, Torrent.DEFAULT_PIECE_LENGTH, announceList, createdBy);
}
IOFileFilter fileFilter = TrueFileFilter.TRUE;
if (ignoreFilter != null) {
fileFilter = new IOFileFilter() {
@Override
public boolean accept(File file) {
String s = file.toString();
for (String prefix : ignoreFilter) {
if (s.startsWith(prefix)) return false;
}
return true;
}
@Override
public boolean accept(File dir, String name) {
return accept(Paths.get(dir.toString(), name).toFile());
}
};
}
List<File> includeFiles = new ArrayList<>(FileUtils.listFiles(source, fileFilter, TrueFileFilter.TRUE));
return Torrent.create(source, includeFiles, Torrent.DEFAULT_PIECE_LENGTH, announceList, createdBy);
}
示例2: DirectoryWalker
/**
* 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;
}
示例3: DirectoryWalker
/**
* 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;
}
示例4: DirectoryWalker
/**
* 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;
}