Class FileChannelCopier

java.lang.Object
org.aoju.bus.core.io.copier.IoCopier<FileChannel,FileChannel>
org.aoju.bus.core.io.copier.FileChannelCopier

public class FileChannelCopier extends IoCopier<FileChannel,FileChannel>
FileChannel 数据拷贝封装
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • FileChannelCopier

      public FileChannelCopier(long count)
      构造
      Parameters:
      count - 拷贝总数,-1表示无限制
  • Method Details

    • copy

      public long copy(FileInputStream in, FileOutputStream out)
      拷贝文件流,使用NIO
      Parameters:
      in - 输入
      out - 输出
      Returns:
      拷贝的字节数
    • copy

      public long copy(FileChannel source, FileChannel target)
      Description copied from class: IoCopier
      执行拷贝
      Specified by:
      copy in class IoCopier<FileChannel,FileChannel>
      Parameters:
      source - 拷贝源,如InputStream、Reader等
      target - 拷贝目标,如OutputStream、Writer等
      Returns:
      拷贝的实际长度