Android文件解压
Android 解压工具类
请注意以下解压工具 是不支持中文路径
/*** * @param archive 解压文件得路径* @param decompressDir 解压文件目标路径* @param isDeleteZip 解压完毕是否删除解压文件* @throws IOException*/public static void unZipFile(String archive, String decompressDir, boolean isDeleteZip) throws IOException {BufferedInputStream bi;ZipFile zf = new ZipFile(archive);Enumeration e = zf.entries();while (e.hasMoreElements()) {ZipEntry ze2 = (ZipEntry) e.nextElement();String entryName = ze2.getName();String path = decompressDir + "/" + entryName;if (ze2.isDirectory()) {File decompressDirFile = new File(path);if (!decompressDirFile.exists()) {decompressDirFile.mkdirs();}} else {String fileDir = path.substring(0, path.lastIndexOf("/"));if (decompressDir.endsWith(RemindAudioConstant.ZIP_FILE_SUFFIX)) {decompressDir = decompressDir.substring(0, decompressDir.lastIndexOf(RemindAudioConstant.ZIP_FILE_SUFFIX));}File fileDirFile = new File(decompressDir);if (!fileDirFile.exists()) {fileDirFile.mkdirs();}String substring = entryName.substring(entryName.lastIndexOf("/") + 1, entryName.length());BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(decompressDir + "/" + substring));bi = new BufferedInputStream(zf.getInputStream(ze2));byte[] readContent = new byte[1024];int readCount = bi.read(readContent);while (readCount != -1) {bos.write(readContent, 0, readCount);readCount = bi.read(readContent);}bos.close();}}zf.close();if (isDeleteZip) {File zipFile = new File(archive);if (zipFile.exists() && zipFile.getName().endsWith(".zip")) {zipFile.delete();}}}
Android文件解压相关推荐
- android zip文件读写,【Android】Zip文件解压方法
android中zip文件解压 public class ZipUtil { /** * 解压到指定路径 * * @param inputStream * @param outPathString * ...
- android zip格式应用,Android 压缩解压zip文件
Android 压缩解压zip文件 上次写了个解压缩功能,但有局限性,比如压缩文件xx.zip 里包括子目录的情况下,执行上次解压缩的功能就不能实现我们想要的效果,于是在网上参考了一下java的解压缩 ...
- android解压zip文件进度条,Android实现文件解压带进度条功能
解压的工具类 package com.example.videodemo.zip; public class ZipProgressUtil { /*** * 解压通用方法 * * @param zi ...
- android zip解压进度_android zip4j之--解压zip文件并实时显示解压进度
Zip文件是我们经常用到压缩文件格式,android中在进行网络请求大批量数据时,通常会采用传递zip文件,这样做即可以减少网络流量的消耗,加快请求的响应速度,又可以减少对存储空间的要求,所以当我们将 ...
- android assets解压,Android assets内压缩文件解压,解压到缓存示例
1.assets内压缩文件解压AssetsZipUtils,包含一个获取文件夹下所有文件路径的方法,方便获取文件使用 public class AssetsZipUtils { public stat ...
- oka文件专家 Android,oka解压专家怎么用 oka解压专家使用教程
oka解压专家怎么用?oka加压专家是一款在ios和mac平台上所推出的压缩软件,专门为苹果用户所打造,其功能十分的齐全,还不是很了解怎么使用oka压缩专家的小伙伴们,下面将会为大家带来这款软件详细的 ...
- Android端解压ZIP文件中文乱码的问题
吐槽 为解决这个问题,在网上徘徊了数小时,被那些盲目搬砖的博主坑死,明明不可行的方案为什么还要搬到自己的口袋呢?这些人真害人不浅,浪费彼此时间!!!吐槽到此为止.上代码: 正文 首先呢,实现此功能用到 ...
- tar常见文件解压法
2019独角兽企业重金招聘Python工程师标准>>> tar常见文件解压法:.gz - z 小写.bz2 - j 小写.xz - J 大写.Z - Z大写 转载于:https:// ...
- gz文件解压命令 linux_linux常用命令和文件上传(FZ)、解压、配置环境变量(JDK)
第141次(Linux) 学习主题:Linux 学习目标: 掌握Linux常用命令 一.Linux常用命令 1-cd命令 change directory – 切换目录 特殊目录符号 :当前目录 –' ...
最新文章
- RS232与RS485的功能与区别!
- 自学Python十二 战斗吧Scrapy!
- VMware vSAN紧盯虚拟化应用
- union distinct_当面试官问你UNION 和UNION ALL之间的区别时该怎么答?
- Android之在linux终端执行shell脚本文件(通过aapt)得到apk包名
- linux块设备驱动中断程序,linux设备驱动归纳总结(六):1.中断的实现
- Ubuntu修复Fix Busybox Initramfs错误
- 阿里巴巴旗下平台口碑推出无人收银技术,改造便利店市场;重庆法院运用 AI 探索“智能判案”...
- Cordova(PhoneGap) 环境搭建与基础
- 部署Vista需要了解的十大事项
- python编程(最简单的rpc代码)
- “Node.js 包已不值得信任”
- 软件工程师关注的播客
- android判断密码字符串,逆向分析苏宁易购安卓客户端加密到解密获取明文密码(附demo验证) | WooYun...
- python mockito arg_that_编程高阶用法–开发者高频词汇
- linux 内存pss,内存耗用:VSS/RSS/PSS/USS
- Python 装逼手机号码方法 低配版 map方法解析
- OC语言之Protocol基本使用
- CAT扫盲:最常用的CAT翻译软件
- 像电影里的黑客高手一样敲代码攻击入侵网站!装逼神器 !