unzip

How to speed up unzipping time in Java / Android?

此生再无相见时 提交于 2019-11-27 10:48:25
Unzipping files on android seems to be dreadfully slow. At first I thought this was just the emulator but it appears to be the same on the phone. I've tried different compression levels, and eventually dropped down to storage mode but it still takes ages. Anyway, there must be a reason! Does anyone else have this problem? My unzip method looks like this: public void unzip() { try{ FileInputStream fin = new FileInputStream(zipFile); ZipInputStream zin = new ZipInputStream(fin); File rootfolder = new File(directory); rootfolder.mkdirs(); ZipEntry ze = null; while ((ze = zin.getNextEntry())!=null

Downloading and unzipping a .zip file without writing to disk

独自空忆成欢 提交于 2019-11-27 10:29:12
I have managed to get my first python script to work which downloads a list of .ZIP files from a URL and then proceeds to extract the ZIP files and writes them to disk. I am now at a loss to achieve the next step. My primary goal is to download and extract the zip file and pass the contents (CSV data) via a TCP stream. I would prefer not to actually write any of the zip or extracted files to disk if I could get away with it. Here is my current script which works but unfortunately has to write the files to disk. import urllib, urllister import zipfile import urllib2 import os import time import

Unzipping directory structure with python

与世无争的帅哥 提交于 2019-11-27 10:00:31
问题 I have a zip file which contains the following directory structure: dir1\dir2\dir3a dir1\dir2\dir3b I'm trying to unzip it and maintain the directory structure however I get the error: IOError: [Errno 2] No such file or directory: 'C:\\\projects\\\testFolder\\\subdir\\\unzip.exe' where testFolder is dir1 above and subdir is dir2. Is there a quick way of unzipping the file and maintaining the directory structure? 回答1: The extract and extractall methods are great if you're on Python 2.6. I have

Unzip a file in c# using 7z.exe

混江龙づ霸主 提交于 2019-11-27 08:42:12
问题 I'm trying to unzip a file from a winform application. I'm using this code : string dezarhiverPath = @AppDomain.CurrentDomain.BaseDirectory + "\\7z.exe"; ProcessStartInfo pro = new ProcessStartInfo(); pro.WindowStyle = ProcessWindowStyle.Hidden; pro.FileName = dezarhiverPath; pro.Arguments = @" e c:\TEST.ZIP"; Process x = Process.Start(pro); x.WaitForExit(); The code doesn't return error but doesn't anything. I tried this command also from cmd : K:\>"C:\Test\7z.exe" e "c:\TEST.ZIP" but in cmd

gradle - download and unzip file from url

亡梦爱人 提交于 2019-11-27 08:17:06
What would be the proper gradle way of downloading and unzipping the file from url ( http )? If possible, I'd like to prevent re-downloading each time I run the task (in ant.get can be achieved by skipexisting: 'true' ). My current solution would be: task foo { ant.get(src: 'http://.../file.zip', dest: 'somedir', skipexisting: 'true') ant.unzip(src: 'somedir' + '/file.zip', dest: 'unpackdir') } still, I'd expect ant-free solution. Any chance to achieve that? There isn't currently a Gradle API for downloading from a URL. You can implement this using Ant, Groovy, or, if you do want to benefit

Extract files from zip without keeping the structure using python ZipFile?

允我心安 提交于 2019-11-27 07:45:59
I try to extract all files from .zip containing subfolders in one folder. I want all the files from subfolders extract in only one folder without keeping the original structure. At the moment, I extract all, move the files to a folder, then remove previous subfolders. The files with same names are overwrited. Is it possible to do it before writing files? Here is a structure for example: my_zip/file1.txt my_zip/dir1/file2.txt my_zip/dir1/dir2/file3.txt my_zip/dir3/file4.txt At the end I whish this: my_dir/file1.txt my_dir/file2.txt my_dir/file3.txt my_dir/file4.txt What can I add to this code ?

Unpack inner zips in zip with Maven

坚强是说给别人听的谎言 提交于 2019-11-27 07:33:59
I can unpack zip file via the maven-dependency plugin, but currently I have the problem that inside that zip file other zip files are include and I need to unpack them as well. How can I do this? You can unzip any files using ant task runner plugin: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.6</version> <executions> <execution> <id>prepare</id> <phase>validate</phase> <configuration> <tasks> <echo message="prepare phase" /> <unzip src="zips/archive.zip" dest="output/" /> <unzip src="output/inner.zip" dest="output/" /> <unzip

unzip (zip, tar, tag.gz) files with ruby

≡放荡痞女 提交于 2019-11-27 06:49:12
I want to unzip a lot of zip files. Is there a module or script that checks which format the zip file is and decompresses it? This should work on Linux, I don't care about other OSs. Florian Feldhaus To extract files from a .tar.gz file you can use the following methods from packages distributed with Ruby: require 'rubygems/package' require 'zlib' tar_extract = Gem::Package::TarReader.new(Zlib::GzipReader.open('Path/To/myfile.tar.gz')) tar_extract.rewind # The extract has to be rewinded after every iteration tar_extract.each do |entry| puts entry.full_name puts entry.directory? puts entry.file

json转换成对象

感情迁移 提交于 2019-11-27 05:30:50
一.gson <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.2.4</version></dependency> //1、创建Gson对象 Gson gson = new Gson(); User user = new User(1, "liujinghan", "123456", "12@12.com"); //2、调用toJson(Object)将对象转为字符串 String json = gson.toJson(user); //{"id":1,"username":"liujinghan","password":"123456","email":"12@12.com"} System.out.println(json); //3、将json字符串封装为java对象[json字符串 的属性名要和javabean的属性一样] User user2 = gson.fromJson(json, User.class); System.out.println(user2); 二.JSONObject   例如: UnZip unZip = (UnZip) JSONObject.toBean(JSONObject.fromObject

How to get Inno Setup to unzip a file it installed (all as part of the one installation process)

巧了我就是萌 提交于 2019-11-27 04:25:15
To save bandwidth/space as well as prevent accidental meddling, the installation files for a database product (call it Ajax), have been zipped up (call that file "AJAX_Install_Files.ZIP). I would like to have Inno-Setup "install" (i.e., copy) the AJAX_Install_Files.ZIP file to the destination, and then Unzip the files into the same folder where the .ZIP file is located. A subsequent program would be fired off by Inno Setup to actually run the install of product "Ajax". I've looked through the documentation, FAQ, and KB at the Inno Setup website , and this does not seem possible other than