package com.bytter.audit.iface.util;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List; public class ExportClass { public static void main(String[] args) throws IOException {
// 导出的补丁包路径
String exportBasePath = "E:\\bug单\\青海\\2019稽核\\补丁\\"
+ new SimpleDateFormat("yyyy.MM.dd").format(new Date()) + "接口补丁";
File file = new File(exportBasePath);
if (!file.exists()) {
file.mkdirs();
} String fileBasePath = "E:\\work2019\\jk_qhys";
List<String> list = getFileList();
System.out.println("待复制文件数量为:【"+list.size()+"】");
for (String sourceFile : list) {
String sourceDirPath = sourceFile.substring(0, sourceFile.lastIndexOf("/"));
String sourceFileName = sourceFile.substring(sourceFile.lastIndexOf("/")+1);
sourceFileName = sourceFileName.indexOf(".java") > 0
? sourceFileName.substring(0, sourceFileName.indexOf(".")) + ".class" : sourceFileName; System.out.println("-----开始拷贝文件:"+sourceFileName);
// 要导出的文件路径
File dirTarget = new File(exportBasePath + sourceDirPath);
if (!dirTarget.exists()) {
dirTarget.mkdirs();
}
System.out.println("目标路径:"+dirTarget.getAbsolutePath());
File targetFile = new File(exportBasePath + sourceDirPath + File.separator + sourceFileName);
// 开始复制文件
File fileSource = new File(fileBasePath + sourceDirPath + File.separator + sourceFileName); copyFile(fileSource, targetFile);
System.out.println("......拷贝完成:"+sourceFileName);
} } private static List getFileList() {
String classFilePath = "\\WebContent\\WEB-INF\\classes";
List<String> list = new ArrayList<String>();
list.add("/jk_qhys/JavaSource/com/bytter/audit/iface/bussiness/readftpfile/ActionReadFtpFile.java");
list.add("/jk_qhys/JavaSource/com/bytter/audit/iface/dumblyThread/dumblyThread.java");
list.add("/jk_qhys/JavaSource/com/bytter/audit/iface/dumblyThread/qhbasethread/BtAuditDaillyDataReadFileDZQD.java");
list.add("/jk_qhys/JavaSource/com/bytter/audit/iface/bussiness/IbtAuditFtpService.java");
list.add("/jk_qhys/JavaSource/com/bytter/audit/iface/bussiness/impl/BtAuditFtpService.java");
list.add("/jk_qhys/JavaSource/com/bytter/audit/iface/dumblyThread/qhbasethread/BtAuditDaillyDataReadFileDZQD.java"); List<String> lists = new ArrayList<String>();
for (Iterator iterator = list.iterator(); iterator.hasNext();) {
String file = (String) iterator.next();
// class文件
if (file.indexOf("/com/") > -1) {
lists.add(classFilePath + file.substring(file.indexOf("/com/")));
}else if(file.indexOf("/WebContent/")>-1){
lists.add(file.substring(file.indexOf("/WebContent/")));
}
}
return lists;
} // 复制文件
public static void copyFile(File sourceFile, File targetFile) throws IOException {
// 新建文件输入流并对它进行缓冲
FileInputStream input = new FileInputStream(sourceFile);
BufferedInputStream inBuff = new BufferedInputStream(input); // 新建文件输出流并对它进行缓冲
FileOutputStream output = new FileOutputStream(targetFile);
BufferedOutputStream outBuff = new BufferedOutputStream(output); // 缓冲数组
byte[] b = new byte[1024 * 5];
int len;
while ((len = inBuff.read(b)) != -1) {
outBuff.write(b, 0, len);
}
// 刷新此缓冲的输出流
outBuff.flush(); // 关闭流
inBuff.close();
outBuff.close();
output.close();
input.close();
} class FileVo {
private String filePath;
private String fileName; public FileVo() {
super();
} public FileVo(String filePath, String fileName) {
super();
this.filePath = filePath;
this.fileName = fileName;
} public String getFilePath() {
return filePath;
} public void setFilePath(String filePath) {
this.filePath = filePath;
} public String getFileName() {
return fileName;
} public void setFileName(String fileName) {
this.fileName = fileName;
} } }

  

java复制项目中的补丁,完整的包路径的更多相关文章

  1. Java Web项目中连接Access数据库的配置方法

    本文是对前几天的"JDBC连接Access数据库的几种方式"这篇的升级.因为在做一些小项目的时候遇到的问题,因此才决定写这篇博客的.昨天已经将博客公布了.可是后来经过一些验证有点问 ...

  2. JAVA WEB项目中各种路径的获取

    JAVA WEB项目中各种路径的获取 标签: java webpath文件路径 2014-02-14 15:04 1746人阅读 评论(0) 收藏 举报  分类: JAVA开发(41)  1.可以在s ...

  3. eclipse java项目中明明引入了jar包 为什么项目启动的时候不能找到jar包 项目中已经 引入了 com.branchitech.app 包 ,但时tomcat启动的时候还是报错? java.lang.ClassNotFoundException: com.branchitech.app.startup.AppStartupContextListener java.lang.ClassN

    eclipse java项目中明明引入了jar包 为什么项目启动的时候不能找到jar包 项目中已经 引入了 com.branchitech.app 包 ,但时tomcat启动的时候还是报错?java. ...

  4. java web项目中 获取resource路径下的文件路径

    public GetResource{ String path = GetResource.class.getClassLoader().getResource("xx/xx.txt&quo ...

  5. linux 下用renameTo方法修改java web项目中文件夹名称问题

    经测试,在Linux环境中安装tomcat,然后启动其中的项目,在项目中使用java.io.File.renameTo(File dest)方法可行. 之前在本地运行代码可以修改,然后传到Linux服 ...

  6. 对Java Web项目中路径的理解

    第一个:文件分隔符 坑比Window.window分隔符 用\;unix采用/.于是用File.separator来跨平台 请注意:这是文件路径.在File f = new File(“c:\\hah ...

  7. Java Web项目中缺少Java EE 6 Libraries怎么添加

    Java Web项目中缺少Java EE 6 Libraries怎么添加 具体步骤如下: 1.项目名称上点击鼠标右键,选择"Build Path-->Configure Build P ...

  8. java web 项目中 简单定时器实现 Timer

    java web 项目中 简单定时器实现 Timer 标签: Java定时器 2016-01-14 17:28 7070人阅读 评论(0) 收藏 举报  分类: JAVA(24)  版权声明:本文为博 ...

  9. java web项目中打开资源文件中文乱码

    1 java web项目中经常使用多模块管理.在某一个模块中添加了一些资源文件.但不是启动项目.有时候需要在程序中读取资源文件内容,打包后放到容器中就不能正常运行了.需要将所有资源文件放到启动项目的 ...

随机推荐

  1. jira:恢复数据:AO_187CCC_SIDEBAR_LINK

    JIRA 恢复数据时报错 ,关键词是找不到 AO_187CCC_SIDEBAR_LINK. 经网上查为 mysql connect jar 包 的版本过高所致. 降低版本后,成功导入数据.

  2. start-all.sh启动HDFS,datanode没有启动

    第一次格式化dfs后,启动并使用hadoop,之后如果再次重新执行了格式化(hdfs namenode -format) start-all.sh启动时就会遇到datanode无法启动的问题,通常情况 ...

  3. Java第二周总结报告

    第二周的学习,开始正式实践进行Java的学习. 本周做了什么? 了解的Java的一些基本知识,如Java变量,数据类型和运算符等.Java变量对不同的数据类型最好采用不同的命名规则,合理的命名有利于提 ...

  4. [LeetCode] 228. 汇总区间

    题目链接: https://leetcode-cn.com/problems/summary-ranges 难度:中等 通过率:48.9% 题目描述: 给定一个无重复元素的有序整数数组,返回数组区间范 ...

  5. Vuejs——slot内容分发

    ①概述: 简单来说,假如父组件需要在子组件内放一些DOM,那么这些DOM是显示.不显示.在哪个地方显示.如何显示,就是slot分发负责的活. ②默认情况下父组件在子组件内套的内容,是不显示的. 例如代 ...

  6. 微信小程序的拖拽、缩放和旋转手势

    在开发中,有时会遇到像App中的手势那样的效果,下面就仿照App实现了一下. wxml部分: <view class="touch-container"> <vi ...

  7. php之CGI、FastCGI、php-fpm运行原理

    学好一门语言,必须懂得他得运行原理,php之CGI.FastCGI.php-fpm运行原理 早期的webserver只处理html等静态文件,但是随着技术的发展,出现了像php等动态语言.webser ...

  8. ELK-6.5.3学习笔记–elk基础环境安装

    本文预计阅读时间 13 分钟 文章目录[隐藏] 1,准备工作. 2,安装elasticsearch. 3,安装logstash. 4,安装kibana 以往都是纸上谈兵,毕竟事情也都由部门其他小伙伴承 ...

  9. linuxCentOS6.8搭建Apache,用http访问svn

    前提:SVN已经安装配置ok,可以正常访问 目前本人svn用小乌龟客户端svn协议访问地址为:svn://ip:3691/opt/svn/repository,端口后面的是svn仓库的路径 那么如果从 ...

  10. Error: unable to perform an operation on node 'rabbit@DESKTOP-6JT7D2H'. Please see diagnostics information and suggestions below.

    https://blog.csdn.net/qq_32814555/article/details/79494533