700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > java zip文件解压缩

java zip文件解压缩

时间:2021-06-18 01:47:04

相关推荐

java zip文件解压缩

/*** 解压zip文件* * @param zipFile* @param zipPath* @throws IOException*/public static void unzip(File zipFile, File zipPath) throws IOException {ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile));ZipEntry entry = null;byte[] data = new byte[1024];int count = 0;while ((entry = zis.getNextEntry()) != null) {String name = entry.getName();name = zipPath.getName() + "/" + name;File file = new File(name);if (entry.isDirectory()) {file.mkdirs();} else {BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file));while ((count = zis.read(data, 0, data.length)) != -1) {bos.write(data, 0, count);}bos.close();}}zis.close();}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。