Class OpenBatch.ParallelBuilder

java.lang.Object
cloud.opencode.base.io.batch.OpenBatch.ParallelBuilder
Enclosing class:
OpenBatch

public static class OpenBatch.ParallelBuilder extends Object
Parallel Batch Operation Builder 并行批量操作构建器
Since:
JDK 25, opencode-base-io V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • ParallelBuilder

      public ParallelBuilder()
  • Method Details

    • parallelism

      public OpenBatch.ParallelBuilder parallelism(int parallelism)
      Set parallelism level 设置并行度
      Parameters:
      parallelism - number of parallel threads | 并行线程数
      Returns:
      this builder | 构建器
    • onProgress

      Set progress callback 设置进度回调
      Parameters:
      callback - callback function | 回调函数
      Returns:
      this builder | 构建器
    • stopOnError

      public OpenBatch.ParallelBuilder stopOnError(boolean stop)
      Stop on first error 遇到第一个错误时停止
      Parameters:
      stop - whether to stop | 是否停止
      Returns:
      this builder | 构建器
    • copyAll

      public BatchResult copyAll(Collection<Path> sources, Path targetDir, CopyOption... options)
      Copy all files in parallel 并行复制所有文件
      Parameters:
      sources - source files | 源文件
      targetDir - target directory | 目标目录
      options - copy options | 复制选项
      Returns:
      batch result | 批量结果
    • moveAll

      public BatchResult moveAll(Collection<Path> sources, Path targetDir, CopyOption... options)
      Move all files in parallel 并行移动所有文件
      Parameters:
      sources - source files | 源文件
      targetDir - target directory | 目标目录
      options - move options | 移动选项
      Returns:
      batch result | 批量结果
    • deleteAll

      public BatchResult deleteAll(Collection<Path> paths)
      Delete all files in parallel 并行删除所有文件
      Parameters:
      paths - files to delete | 要删除的文件
      Returns:
      batch result | 批量结果
    • execute

      public BatchResult execute(String operation, Collection<Path> paths, OpenBatch.PathAction action)
      Execute custom operation in parallel 并行执行自定义操作
      Parameters:
      operation - operation name | 操作名称
      paths - paths to process | 要处理的路径
      action - action to perform | 要执行的操作
      Returns:
      batch result | 批量结果