unrar

java解压zip rar文件实例

China☆狼群 提交于 2019-11-27 12:12:45
package com.tservice.mrn.common; import java.io.*; import java.util.Enumeration; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Expand; import org.apache.tools.zip.*; import com.github.junrar.Archive; import com.github.junrar.rarfile.FileHeader; public abstract class ZipUtils { private static final int BUFFEREDSIZE = 1024; /** * @SuppressWarnings({ "rawtypes", "resource" }) public static String * unzip(File zipFile, String unzipDir, String * zipFileName) throws IOException { ZipFile zf = new * ZipFile(zipFile); Enumeration enu = zf.entries(); * String result = "";

How can unrar a file with python

一世执手 提交于 2019-11-26 18:31:23
问题 I can to unzip a file if file is a .zip and unrar file if my file type is .rar . How i can do this work with python 2.7? 回答1: Try the pyunpack package: from pyunpack import Archive Archive('a.zip').extractall('/path/to') 回答2: Late, but I wasn't satisfied with any of the answers. pip install patool import patoolib patoolib.extract_archive("foo_bar.rar", outdir="path here") Works on Windows and linux without any other libraries needed. 回答3: A good package for it is rarfile : Infos and docs here