public class ZipFileDemo {
@SuppressWarnings("resource")
public static void main(String args[]) throws Exception {
File file = new File("d:" + File.separator + "test.zip");
File outFile = null;
ZipFile zipFile = new ZipFile(file);
ZipInputStream zipInput = new ZipInputStream(new FileInputStream(file));
ZipEntry entry = null;
InputStream input = null;
OutputStream out = null;
while ((entry = zipInput.getNextEntry()) != null) {
System.out.println("开始解压缩" + entry.getName() + "文件 。。。");
outFile = new File("d:" + File.separator + entry.getName());
if (!outFile.getParentFile().exists()) {
outFile.getParentFile().mkdir();
}
if (!outFile.exists()) {
outFile.createNewFile();
}
input = zipFile.getInputStream(entry);
out = new FileOutputStream(outFile);
int temp = 0;
while ((temp = input.read()) != -1) {
SPAN style="WHITE-SPACE: pre" /SPAN//System.out.println(temp);
out.write(temp);
}
input.close();
out.close();
}
System.out.println("Done!");
}
}
仅供参考
【java解压缩文件代码 java实现解压缩】java解压缩文件代码的介绍就聊到这里吧 , 感谢你花时间阅读本站内容,更多关于java实现解压缩、java解压缩文件代码的信息别忘了在本站进行查找喔 。
推荐阅读
- 微距拍摄用什么相机,微距相机推荐
- 变配电gis是指什么,变电站gis有哪些设备组成
- 有哪些体育竞技游戏,体育竞技类网游
- 终止linux所有命令 linux终止运行的程序
- 如何做好微信营销的可行性,如何做好微信营销的可行性分析
- 安卓手机系统恢复微信,安卓系统恢复微信聊天记录
- 好玩儿的即时策略战争游戏,好玩的即时战略游戏推荐
- javarsa源代码 java源代码是什么格式
- 关于chatgpt怎么做视频的信息