拉钩-Java工程师就业急训营完结无密
download:拉钩-Java工程师就业急训营
import java.io.*;
import java.util.*;
import java.util.zip.*;
public class FolderUnzip {
private static String sourcepath="D:\tmp";
private static ListfolderList=new ArrayList(Arrays.asList(sourcepath));
private static ListfolderList2=new ArrayList(Arrays.asList("E:\tt"+File.separator+sourcepath.substring(sourcepath.lastIndexOf(File.separator))));
private static FileInputStream fis = null;
private static FileOutputStream fos = null;
private static ZipInputStream zipin = null;
public static void main(String[] args) {
for (int j = 0;
j < folderList.size();
j++) {
new File(folderList2.get(j)).mkdirs();
String[] file = new File(folderList.get(j)).list();
File temp = null;
for (int i = 0;
i < file.length;
i++) {
if (folderList.get(j).endsWith(File.separator))
temp = new File(folderList.get(j), file[i]);
else
temp = new File(folderList.get(j), file[i]);
File originalFile = null;
if (temp.getName().endsWith(".zip"))
originalFile = new File(folderList2.get(j), temp.getName()
.substring(0, temp.getName().lastIndexOf('.')));
if (temp.isFile() && !originalFile.exists()) {
try {
fis = new FileInputStream(temp);
zipin = new ZipInputStream(fis);
ZipEntry entry = zipin.getNextEntry();
fos = new FileOutputStream(new File(folderList2.get(j),entry.getName()));
byte[] buffer = new byte[20480];
int nNumber;
while ((nNumber = zipin.read(buffer, 0, buffer.length)) != -1)
fos.write(buffer, 0, nNumber);
fos.flush();
} catch (IOException e) {
continue;
} finally {
try {
zipin.close();
fos.close();
fis.close();
} catch (IOException e) {
}
}
} else if (temp.isDirectory()) {
folderList.add(folderList.get(j) + File.separator + file[i]);
folderList2.add(folderList2.get(j) + File.separator+ file[i]);
}
}
}
}
【拉钩-Java工程师就业急训营完结无密】}
推荐阅读
- 我的软件测试开发工程师书单
- 1-Java基础知识
- [学习笔记]|[学习笔记] 02 测试工程师是怎么使用fiddler的
- XS-Java数据结构和算法目录总纲【2020-10-24~2021-2-12】
- 转行web前端工程师需要学习什么内容
- 面试题-Java基础
- 2019年陕西省建筑中级工程师报名条件-建筑中级工程师报名条件
- 标杆房企项目工程师的6种能力
- Java|Java 工程师如何开发 AI 项目()
- Spark--java.util.NoSuchElementException:|Spark--java.util.NoSuchElementException: None.get at at