您的位置:首页 > 游戏 > 游戏 > 表白视频制作软件app_莱芜金点子最新招聘电子版_职业培训网络平台_百度竞价怎么开户

表白视频制作软件app_莱芜金点子最新招聘电子版_职业培训网络平台_百度竞价怎么开户

2025/2/13 19:26:51 来源:https://blog.csdn.net/qq_48192676/article/details/143950392  浏览:    关键词:表白视频制作软件app_莱芜金点子最新招聘电子版_职业培训网络平台_百度竞价怎么开户
表白视频制作软件app_莱芜金点子最新招聘电子版_职业培训网络平台_百度竞价怎么开户

 很多时候需要把一个预制的zip文件解压到根目录,下面是一个实例代码:

	private static final int BUFFER_SIZE = 4096;public static void unZip(String zipFilePath, String targetDir) throws IOException {File destDir = new File(targetDir);if (!destDir.exists()) {destDir.mkdirs();}try (FileInputStream fis = new FileInputStream(zipFilePath);ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis))) {ZipEntry entry;while ((entry = zis.getNextEntry()) != null) {String entryName = entry.getName();File file = new File(destDir, entryName);if (entry.isDirectory()) {file.mkdirs();} else {extractFile(zis, file);}zis.closeEntry();}}}private static void extractFile(ZipInputStream zis, File file) throws IOException {File parent = file.getParentFile();if (!parent.exists()) {parent.mkdirs();}try (FileOutputStream fos = new FileOutputStream(file);BufferedOutputStream bos = new BufferedOutputStream(fos, BUFFER_SIZE)) {byte[] buffer = new byte[BUFFER_SIZE];int read;while ((read = zis.read(buffer)) != -1) {bos.write(buffer, 0, read);}}}

使用实例:

unZip("/system/media/xxx.zip", "/storage/emulated/0/");

包自己导入一下就行了

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com