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


Java TrueFileFilter.TRUE属性代码示例

本文整理汇总了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);
}
 
开发者ID:cjmalloy,项目名称:torrent-fs,代码行数:27,代码来源:TfsUtil.java

示例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;
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:26,代码来源:DirectoryWalker.java

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

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


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