/**
*包名:cn.yufu.utils
*描述:package cn.yufu.utils;
*/
package cn.yufu.utils; import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream; /**
* WarUtil.java 版权所有(C) 2017 裕福控股有限公司 创建:gll 时间:2017年7月28日 描述:TODO
*/
public class WarUtil {
public static void main(String[] args) { Map<String, Object> map = TxtUtil.readTxtFile("E:\\test\\jilu.txt");
List<String> list = (List<String>) map.get("list");
if ((Boolean) map.get("flag")) {
for (String string : list) {
System.out.println(string);
}
}
if(list.size() ==0 || null == list){ }else{
CreateFileAndJar(list);
}
} public static void CreateFileAndJar(List<String> list) {
String s="";
for(int i=0;i<list.size();i++){
s = list.get(i);
// File inFile = new File(list.get(i));
// JarEntry zipEntry = new JarEntry(inFile.getName());
}
File inFile = new File(s);
JarEntry zipEntry = new JarEntry(inFile.getName()); try {
InputStream ins = new FileInputStream(inFile);
byte[] datas = new byte[ins.available()];
ins.read(datas);
ins.close(); JarOutputStream zout = new JarOutputStream(new FileOutputStream("D:/Jar/goujianfei.jar")); zout.putNextEntry(zipEntry);
zout.write(datas); zout.closeEntry();
zout.finish();
zout.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} }

  

WarUtil的更多相关文章

随机推荐

  1. mitmproxy 代理介绍及入门

    转载请注明出处 https://www.cnblogs.com/majianming/p/11823669.html mitmproxy 是一个python 写成的代理工具,可以代理https.htt ...

  2. demo_service

    <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit ...

  3. Windows服务 --- SqlDependency的使用

    1   启用当前数据库的 SQL Server Service Broker a   检查Service Broker 是否开启 SELECT is_broker_enabled FROM sys.d ...

  4. v-bin:href 绑定链接

    <div id="app06"> <a v-bind:href="URL">我是百度</a> </div> 调用 ...

  5. linux IPC 消息队列(二)

    我在网上想找多进程之间的通信方式,发现有人写的消息队列很好,搬过来: common.h #ifndef __COMMON_H_ #define __COMMON_H_ #include <std ...

  6. POJ 2443 Set Operation (按位压缩)

    Description You are given N sets, the i-th set (represent by S(i)) have C(i) element (Here "set ...

  7. 常用js校验

    身份证 function isCardNo(idCard){ //15位和18位身份证号码的正则表达式 var regIdCard=/^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0 ...

  8. Python基础教程(008)--第一个Python程序

    前言: 学会第一个Python程序 了解Python2和Python3的区别 内容 执行Python程序的三种方式 解释器--Python.Python3 交互式-- ipthon 集成开发环境--P ...

  9. centos6 sersync2使用

    接收端rsyncd搭建 http://www.cnblogs.com/hanxiaohui/p/8675409.html 推送端sersync2使用 安装 源码包D:\share\src\sersyn ...

  10. 跨站请求伪造(CSRF)与跨域问题

    1.CSRF定义 伪装来自受信任用户的请求来访问受信任的网站,(攻击者盗用了你的身份,以你的名义发送恶意请求) 产生条件 1.用户要登录受信任的网站,并在本地生成cookie 2.在不退出安全网站的情 ...