unzip

Unzip a zipped file on sd card in Android application

只愿长相守 提交于 2019-11-26 07:46:00
问题 I have a zipped password protected a video file saved on sd card on android emulator. Now i want to unzip that video file on sd card through code. How can i achieve that? Any help or code? Thanks in advance 回答1: import android.util.Log; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; /** * * @author jon */ public class Decompress { private String _zipFile; private String _location; public

Simple way to unzip a .zip file using zlib [duplicate]

☆樱花仙子☆ 提交于 2019-11-26 07:22:38
问题 This question already has an answer here: Unzip a zip file using zlib 3 answers Is there a simple example of how to unzip a .zip file and extract the files to a directory? I am currently using zlib, and while I understand that zlib does not directly deal with zip files, there seems to be several additional things in zlibs\'s \"contrib\" library. I noticed and read about \"minizip\", and after reading some documents and looking at some of the code, I do not see a simple example of how to unzip

How to unzip files recursively in Java?

时间秒杀一切 提交于 2019-11-26 06:30:32
问题 I have zip file which contains some other zip files. For example, the mail file is abc.zip and it contains xyz.zip , class1.java , class2.java . And xyz.zip contains the file class3.java and class4.java . So I need to extract the zip file using Java to a folder that should contain class1.java , class2.java , class3.java and class4.java . 回答1: Warning, the code here is ok for trusted zip files, there's no path validation before write which may lead to security vulnerability as described in zip

Unzipping downloaded files in iOS

醉酒当歌 提交于 2019-11-26 05:28:25
问题 Using ASIHTTPRequest, I downloaded a zip file containing a folder with several audio files. I tried to unzip the file with SSZipArchive and ZipArchive , which are both based on minizip . When I compile the code, I get this error: Undefined symbols for architecture i386: \"_OBJC_CLASS_$_ZipArchive\", referenced from: objc-class-ref in AppDelegate.o . How do I unzip this file in iOS? 回答1: I've used ZipArchive with success in the past. It's pretty ligthweight and simple to use, supports password

Unzipping and the * operator

落爺英雄遲暮 提交于 2019-11-26 05:27:33
问题 The python docs gives this code as the reverse operation of zip: >>> x2, y2 = zip(*zipped) In particular \"zip() in conjunction with the * operator can be used to unzip a list\". Can someone explain to me how the * operator works in this case? As far as I understand, * is a binary operator and can be used for multiplication or shallow copy...neither of which seems to be the case here. 回答1: When used like this, the * (asterisk, also know in some circles as the "splat" operator) is a signal to

Unzipping files in Python

僤鯓⒐⒋嵵緔 提交于 2019-11-26 04:29:50
问题 I read through the zipfile documentation, but couldn\'t understand how to unzip a file, only how to zip a file. How do I unzip all the contents of a zip file into the same directory? 回答1: import zipfile with zipfile.ZipFile(path_to_zip_file, 'r') as zip_ref: zip_ref.extractall(directory_to_extract_to) That's pretty much it! 回答2: If you are using Python 3.2 or later: import zipfile with zipfile.ZipFile("file.zip","r") as zip_ref: zip_ref.extractall("targetdir") You dont need to use the close

java.util.zip.ZipException: error in opening zip file

放肆的年华 提交于 2019-11-26 03:40:24
问题 I have a Jar file, which contains other nested Jars. When I invoke the new JarFile() constructor on this file, I get an exception which says: java.util.zip.ZipException: error in opening zip file When I manually unzip the contents of this Jar file and zip it up again, it works fine. I only see this exception on WebSphere 6.1.0.7 and higher versions. The same thing works fine on tomcat and WebLogic. When I use JarInputStream instead of JarFile, I am able to read the contents of the Jar file

Unzip files programmatically in .net

喜夏-厌秋 提交于 2019-11-26 03:32:29
问题 I am trying to programatically unzip a zipped file. I have tried using the System.IO.Compression.GZipStream class in .NET, but when my app runs (actually a unit test) I get this exception: System.IO.InvalidDataException: The magic number in GZip header is not correct. Make sure you are passing in a GZip stream.. I now realize that a .zip file is not the same as a .gz file, and that GZip is not the same as Zip . However, since I\'m able to extract the file by manually double clicking the

What is a good Java library to zip/unzip files? [closed]

拟墨画扇 提交于 2019-11-26 03:02:15
问题 I looked at the default Zip library that comes with the JDK and the Apache compression libs and I am unhappy with them for 3 reasons: They are bloated and have bad API design. I have to write 50 lines of boiler plate byte array output, zip input, file out streams and close relevant streams and catch exceptions and move byte buffers on my own? Why can\'t I have a simple API that looks like this Zipper.unzip(InputStream zipFile, File targetDirectory, String password = null) and Zipper.zip(File

How to unzip files programmatically in Android?

家住魔仙堡 提交于 2019-11-26 00:40:00
问题 I need a small code snippet which unzips a few files from a given .zip file and gives the separate files according to the format they were in the zipped file. Please post your knowledge and help me out. 回答1: Had peno's version optimised a bit. The increase in performance is perceptible. private boolean unpackZip(String path, String zipname) { InputStream is; ZipInputStream zis; try { String filename; is = new FileInputStream(path + zipname); zis = new ZipInputStream(new BufferedInputStream(is