android 关于zip4j的一些天坑

1.最近的项目中有个需求,就是从oos上下载压缩包并且解压,对swf解密的需求。2.解压过程中,要显示解压进度。解压成功后对swf文件解密。3.关于显示解压进度的天坑:网上十片有八篇的方法:/** * @param zipFile 需要解压的文件 * @param filePath 解压后的文件目录 * @param isDeleteZip...
摘要由CSDN通过智能技术生成

1.最近的项目中有个需求,就是从oos上下载压缩包并且解压,对swf解密的需求。

2.解压过程中,要显示解压进度。解压成功后对swf文件解密。

3.关于显示解压进度的天坑:网上十片有八篇的方法:

/**
     * @param zipFile     需要解压的文件
     * @param filePath    解压后的文件目录
     * @param isDeleteZip 是否删除解压包
     * @throws ZipException
     */
    private void unZipFileWithProgress(File zipFile, String filePath, boolean isDeleteZip) throws ZipException {
        String usbOrTfPath = zipFile.getAbsolutePath();
        ZipFile zFile = new ZipFile(zipFile);
        zFile.setFileNameCharset("GBK");
        if (!zFile.isValidZipFile()) {
            if (zipFileImp != null) {
                flag_unZip = false;
                zipFileImp.copyAndUnPackFailed("文件不合法或不存在" + zipFile.getAbsolutePath());
            }
            Log.e("======", "文件不合法或不存在" + zipFile.getAbsolutePath());
            return;
        }
        File destDir = new File(filePath); // ��ѹĿ¼
        if (destDir.isDirectory() && !destDir.exists()) {
            destDir.mkdir();
        }
        if (zFile.isEncrypted()) {
            // zFile.setPassword(password); // 设置解压密码
        }


        // if (totalWork != 0) {
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    flag_unZip = true;
                    ProgressMonitor progressMonitor = zFile.getProgressMonitor();
                    int precentDone = 1;
                    boolean isFileeixst = false;
                    while (flag_unZip) {
                        Log.i("TTFFGG", "RRRR");
                      
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值