当前位置: 首页 > news >正文

广州市住房和城乡建设部网站英文外链代发

广州市住房和城乡建设部网站,英文外链代发,韶关做网站需要多少钱,有道云笔记做网站目录 1 需求2 实现 1 需求 我现在有一个300MB 的文件,想要根据这个文件,创建100万个大小一样的,名称不一样,如何实现,如何比较快点实现 2 实现 1 先准备好这个文件 2 准备好目录 3 写代码 private static void crea…

目录

  • 1 需求
  • 2 实现

1 需求

我现在有一个300MB 的文件,想要根据这个文件,创建100万个大小一样的,名称不一样,如何实现,如何比较快点实现

2 实现

1 先准备好这个文件

在这里插入图片描述

2 准备好目录

在这里插入图片描述
3 写代码

private static void createFile(String sourceFilePath,String destinationFolderPath, int fileNumber) {File file1 = new File(sourceFilePath);Path sourcePath = Paths.get(sourceFilePath);String destinationFileName = "copy_" + UUID.randomUUID().toString() + "_" + file1.getName();Path destinationPath = Paths.get(destinationFolderPath, destinationFileName);//try {// 复制源文件到目标文件Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING);} catch (IOException e) {e.printStackTrace();}}public static void main(String[] args) {String sourceFilePath = "D:\\100w\\source\\1111111111111.HDF"; // 替换为实际的源文件路径String destinationFolderPath = "D:\\100w\\dest"; // 替换为实际的目标文件夹路径int numFiles = 1000000; // 需要创建的文件数量int numThreads = Runtime.getRuntime().availableProcessors(); // 使用可用的处理器核心数作为线程数ExecutorService executorService = Executors.newFixedThreadPool(numThreads);try {// 创建目标文件夹(如果不存在)Files.createDirectories(Paths.get(destinationFolderPath));// 循环提交文件创建任务给线程池for (int i = 100; i < numFiles; i++) {int fileNumber = i;executorService.submit(() -> createFile(sourceFilePath,destinationFolderPath, fileNumber));}executorService.shutdown();} catch (IOException e) {e.printStackTrace();}//        try {//            // 获取源文件的路径对象//            Path sourcePath = Paths.get(sourceFilePath);////            // 创建目标文件夹(如果不存在)//            Files.createDirectories(Paths.get(destinationFolderPath));////            // 循环复制文件并创建副本文件//            for (int i = 0; i < numFiles; i++) {//                // 构造目标文件的路径对象//                String destinationFileName = "copy_" + i + "_" + sourcePath.getFileName();//                Path destinationPath = Paths.get(destinationFolderPath, destinationFileName);////                // 复制源文件到目标文件//                Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING);//            }////            System.out.println("文件复制完成!");//        } catch (IOException e) {//            e.printStackTrace();//        }}
http://www.zhongyajixie.com/news/5427.html

相关文章:

  • 哪个公司做网站最好深圳如何发布自己的html网站
  • 南京网站制作公司电话全球搜效果怎么样
  • 长春网站建设于健短网址链接生成
  • 织梦模板修改教程宁波网站关键词优化排名
  • 长沙手机网站设计专注于网站营销服务
  • 商品网页设计图片济南seo优化公司
  • 网站建设需要会什么惠州seo计费管理
  • google网站登录入口竞价代运营公司哪家好
  • 星辰wordpress主题广州seo做得比较好的公司
  • 网站主页和子页怎么做整站优化的公司
  • 网上有做logo的网站吗今日新闻摘抄
  • 网站挖掘工具永久免费个人网站注册
  • 设计网站界面百度搜索推广多少钱
  • 开发企业网站的公司太原网站seo
  • 学做网站要多久多少钱seo外包一共多少钱
  • 国外服务器地址aso优化的主要内容为
  • 做网络推广选择哪个网站好seo优化点击软件
  • 视频网站后台管理系统免费建站的网站哪个好
  • 长春建站最新消息网站关键字优化价格
  • 别人的做网站上海百度seo网站优化
  • dz网站首页html代码在哪做百度关键词排名的公司
  • 公众号微网站开发品牌推广方案ppt
  • 网页模板下载 免费 html哪个网站学seo是免费的
  • 帮公司做网站网站优化外包多少钱
  • 二维码制作长沙建站优化
  • 深圳专业企业网站制作哪家好网络营销的推广方法
  • 万网独立主机 怎么做多个网站搜索引擎大全
  • 公司网络宣传推广方案seo属于运营还是技术
  • 系统下载网站源码免费seo网站自动推广软件
  • 网站怎么收费的武汉seo服务