unzip

How to zip and unzip the files?

徘徊边缘 提交于 2019-11-26 15:19:38
问题 How to zip and unzip the files which are all already in DDMS : data/data/mypackage/files/ I need a simple example for that. I've already search related to zip and unzip. But, no one example available for me. Can anyone tell some example. Advance Thanks. 回答1: Take a look at java.util.zip.* classes for zip functionality. I've done some basic zip/unzip code, which I've pasted below. Hope it helps. public static void zip(String[] files, String zipFile) throws IOException { BufferedInputStream

gradle - download and unzip file from url

核能气质少年 提交于 2019-11-26 13:58:19
问题 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? 回答1: There isn't currently a

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

时间秒杀一切 提交于 2019-11-26 13:27:11
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 without any exceptions. arulraj.net Make sure your jar file is not corrupted. If it's corrupted or not

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

我与影子孤独终老i 提交于 2019-11-26 12:55:20
问题 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. 回答1: 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

How to download and unzip a zip file in memory in NodeJs?

可紊 提交于 2019-11-26 12:54:23
问题 I want to download a zip file from the internet and unzip it in memory without saving to a temporary file. How can I do this? Here is what I tried: var url = \'http://bdn-ak.bloomberg.com/precanned/Comdty_Calendar_Spread_Option_20120428.txt.zip\'; var request = require(\'request\'), fs = require(\'fs\'), zlib = require(\'zlib\'); request.get(url, function(err, res, file) { if(err) throw err; zlib.unzip(file, function(err, txt) { if(err) throw err; console.log(txt.toString()); //outputs

Unzip files programmatically in .net

六月ゝ 毕业季﹏ 提交于 2019-11-26 12:05:01
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 zipped file and then clicking the "Extract all files"-button, I think there should be a way of doing that in

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

喜夏-厌秋 提交于 2019-11-26 11:30:37
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 targetDirectory, String password = null) that just works? It seems zipping unzipping destroys file meta

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

旧时模样 提交于 2019-11-26 11:00:51
问题 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

Android - Unzip a folder?

徘徊边缘 提交于 2019-11-26 10:47:13
问题 I have a zip folder on my SD card, how do i unzip the folder (within my application code) ? 回答1: I am using a modified version of Beginner's method that extends AsyncTask and can update Observers on the main thread. Byte by byte compression is extremely slow and should be avoided. Instead a more efficient approach is to copy large chunks of data to the output stream. package com.blarg.webviewscroller; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File

How do you unzip very large files in python?

半世苍凉 提交于 2019-11-26 09:33:59
问题 Using python 2.4 and the built-in ZipFile library, I cannot read very large zip files (greater than 1 or 2 GB) because it wants to store the entire contents of the uncompressed file in memory. Is there another way to do this (either with a third-party library or some other hack), or must I \"shell out\" and unzip it that way (which isn\'t as cross-platform, obviously). 回答1: Here's an outline of decompression of large files. import zipfile import zlib import os src = open( doc, "rb" ) zf =