Class MoreFiles.FileTreeTraversal
java.lang.Object
cloud.opencode.base.io.file.MoreFiles.FileTreeTraversal
- Enclosing class:
MoreFiles
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 Summary
Modifier and TypeMethodDescriptionlongcount()Counts matching paths.Filters for directories only.Filters for regular files only.Sets file filter.Follows symbolic links.voidApplies action to each matching path.Filters by glob pattern.matcher(BiPredicate<Path, BasicFileAttributes> matcher) Sets BiPredicate matcher with file attributes.maxDepth(int maxDepth) Sets maximum depth to traverse.stream()Returns stream of matching paths.toList()Collects all matching paths to a list.
-
Method Details
-
maxDepth
Sets maximum depth to traverse. 设置最大遍历深度。- Parameters:
maxDepth- maximum depth | 最大深度- Returns:
- this builder | 此构建器
-
followSymlinks
Follows symbolic links. 跟随符号链接。- Returns:
- this builder | 此构建器
-
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
Filters for regular files only. 仅过滤常规文件。- Returns:
- this builder | 此构建器
-
directoriesOnly
Filters for directories only. 仅过滤目录。- Returns:
- this builder | 此构建器
-
glob
Filters by glob pattern. 按 glob 模式过滤。- Parameters:
pattern- the glob pattern | glob 模式- Returns:
- this builder | 此构建器
-
stream
-
toList
-
forEach
-
count
public long count()Counts matching paths. 计算匹配路径的数量。- Returns:
- count | 数量
-