Class MoreFiles.FileTreeTraversal

java.lang.Object
cloud.opencode.base.io.file.MoreFiles.FileTreeTraversal
Enclosing class:
MoreFiles

public static final class MoreFiles.FileTreeTraversal extends Object
File Tree Traversal Builder 文件树遍历构建器

Provides fluent API for configuring file tree traversal.

提供用于配置文件树遍历的流式 API。

Since:
JDK 25, opencode-base-io V1.2.0
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • maxDepth

      public MoreFiles.FileTreeTraversal maxDepth(int maxDepth)
      Sets maximum depth to traverse. 设置最大遍历深度。
      Parameters:
      maxDepth - maximum depth | 最大深度
      Returns:
      this builder | 此构建器
    • followSymlinks

      public MoreFiles.FileTreeTraversal followSymlinks()
      Follows symbolic links. 跟随符号链接。
      Returns:
      this builder | 此构建器
    • filter

      public MoreFiles.FileTreeTraversal filter(Predicate<Path> filter)
      Sets file filter. 设置文件过滤器。
      Parameters:
      filter - the filter | 过滤器
      Returns:
      this builder | 此构建器
    • matcher

      Sets BiPredicate matcher with file attributes. 设置带文件属性的 BiPredicate 匹配器。
      Parameters:
      matcher - the matcher | 匹配器
      Returns:
      this builder | 此构建器
    • filesOnly

      public MoreFiles.FileTreeTraversal filesOnly()
      Filters for regular files only. 仅过滤常规文件。
      Returns:
      this builder | 此构建器
    • directoriesOnly

      public MoreFiles.FileTreeTraversal directoriesOnly()
      Filters for directories only. 仅过滤目录。
      Returns:
      this builder | 此构建器
    • glob

      public MoreFiles.FileTreeTraversal glob(String pattern)
      Filters by glob pattern. 按 glob 模式过滤。
      Parameters:
      pattern - the glob pattern | glob 模式
      Returns:
      this builder | 此构建器
    • stream

      public Stream<Path> stream()
      Returns stream of matching paths. 返回匹配路径的流。
      Returns:
      stream of paths | 路径流
    • toList

      public List<Path> toList()
      Collects all matching paths to a list. 收集所有匹配路径到列表。
      Returns:
      list of paths | 路径列表
    • forEach

      public void forEach(Consumer<Path> action)
      Applies action to each matching path. 对每个匹配路径应用操作。
      Parameters:
      action - the action | 操作
    • count

      public long count()
      Counts matching paths. 计算匹配路径的数量。
      Returns:
      count | 数量