unzip

Unzipping file Zip Exception: invalid entry size (expected 193144 but got 193138 bytes)

时光怂恿深爱的人放手 提交于 2019-12-05 05:17:04
I am trying to unzip a file (retrieved from an FTP server): ZipInputStream zis = new ZipInputStream( new FileInputStream(zipFile)); ZipEntry ze = zis.getNextEntry(); while (ze != null) { String fileName = ze.getName(); File newFile = new File(outputFileName+outputFolder + File.separator + fileName); System.out.println("file unzip : " + newFile.getAbsoluteFile()); FileOutputStream fos = new FileOutputStream(newFile); int len; while ((len = zis.read(buffer)) > 0) { fos.write(buffer, 0, len); } fos.close(); sendFile = newFile; ze = zis.getNextEntry(); } zis.closeEntry(); zis.close(); System.out

Unix unzip: how to batch unzip zip files in a folder and save in subfolders?

允我心安 提交于 2019-12-05 03:15:55
问题 Say if I have a folder 'images' and inside it there are 0001.zip to 9999.zip, I want to unzip all of them and save them in subfolder which has their file name, for example, 0001.zip will be unzipped and saved to /0001, 0002.zip will be unzipped and saved to /0002, I tried to do unzip '*.zip' but that extracts all files in current folder. 回答1: You could do something like this: for file in *.zip; do dir=$(basename "$file" .zip) # remove the .zip from the filename mkdir "$dir" cd "$dir" && unzip

Unzip NSData without temporary file

元气小坏坏 提交于 2019-12-05 00:12:45
I've found a couple of libs ( LiteZip and ZipArchive ) that allow to unzip files on iPhone. But both of them require an input as a file. Is there a library that allows to directly unzip NSData containing zip-archived data without writing it to temporary file? I've tried to adopt mentioned above libs for that, but with no success so far. Brad Larson In this answer to this question , I point out the CocoaDev wiki category on NSData which adds zip / unzip support to that class. This would let you do this entirely in memory. From what I understand, the zip format stores files separately and each

unzip contents in-app purchase ios

时光怂恿深爱的人放手 提交于 2019-12-04 17:38:09
apple hosted contents are downloading as .zip in case of in-app purchase. m trying to unzip these contents but filed to open .zip file with zipArchive. ZipArchive* za = [[ZipArchive alloc] init]; za.delegate = self; NSString *path = [download.contentURL path]; if([[NSFileManager defaultManager] fileExistsAtPath:path]) { NSLog(@"File Exists: %@", path); } else { NSLog(@"file not exists: %@", path); } if( [za UnzipOpenFile:path] ) { if( [za UnzipFileTo:dir overWrite:YES] != NO ) { NSLog(@"unzip data success"); //unzip data success //do something } else { NSLog(@"unzip failed"); } [za

软件管理

折月煮酒 提交于 2019-12-04 17:27:35
软件管理 RPM软件包管理 源码包管理 压缩与解压缩 linux software manager 一.RPM软件包 适用于redhat redflag centos suse 1)rpm 命令 rpm -ivh 1 i 安装 2 v 显示安装过程 3 h hash [Use with -v|--verbose for a nicer display.] 4 q 查找 查询 5 -qf 查看某个文件时属于哪个软件包 6 -qi 查看软件包的信息【出厂信息】 7 -qa 查找已安装所有匹配XXX关键字的软件包 8 -e 卸载rpm软件包 9 -ql 查看软件包包含哪些文件 10 -U 升级软件包 思考问题 依赖问题 —nodeps 软包安装不完整 重新安装 —replacepkgs —force 2)YUM 安装 YUM C/S架构 1 YUM源服务器 [共享所有软件包] 通过文件服务器 【http ftp file】 2 YUM客户端 3 YUM客户端配置文件设置 YUM 客户端配置文件 /etc/yum.repos.d/ 配置文件名字两部分组成 *.repo 前半部分可以随便写 后半部分必须是repo 1 [baism] 2 name=www.ayitula.com 3 baseurl=ftp://192.168.10.253/pub 4 enabled=1 5 gpgcheck

Poor Performance of Java's unzip utilities

主宰稳场 提交于 2019-12-04 12:21:13
问题 I have noticed that the unzip facility in Java is extremely slow compared to using a native tool such as WinZip. Is there a third party library available for Java that is more efficient? Open Source is preferred. Edit Here is a speed comparison using the Java built-in solution vs 7zip. I added buffered input/output streams in my original solution (thanks Jim, this did make a big difference). Zip File size: 800K Java Solution: 2.7 seconds 7Zip solution: 204 ms Here is the modified code using

Zipping and Unzipping tool for Flash ActionScript 2

a 夏天 提交于 2019-12-04 10:06:54
Are you aware of any zip/unzip component or script for flash / actionscript 2 ? I'm aware of this library for flex / AS3, but is there one for AS2 that will save me a long conversion attempt? Is there such a library that supports creating/parsing password protected zip files? back2dos basically it can be done ... but will be slow ... http://code.google.com/p/hxformat/ actually you would load the string and then it'll be decoded into an Array of bytes (using Bytes.ofString) ... this will take a lot of time ... and you will not be able to do a lot with the results, i guess, since AS2 api is very

How to open gzip text files in Gvim without unzipping?

半城伤御伤魂 提交于 2019-12-04 08:59:03
问题 How to open Gzipped text files (*.gz) in Gvim without unzipping them first ? 回答1: Solution mentioned in VimDocs as answered by therefromwhere augroup gzip autocmd! autocmd BufReadPre,FileReadPre *.gz set bin autocmd BufReadPost,FileReadPost *.gz '[,']!gunzip autocmd BufReadPost,FileReadPost *.gz set nobin autocmd BufReadPost,FileReadPost *.gz execute ":doautocmd BufReadPost " . expand("%:r") autocmd BufWritePost,FileWritePost *.gz !mv <afile> <afile>:r autocmd BufWritePost,FileWritePost *.gz

Linux常用命令大全

时光毁灭记忆、已成空白 提交于 2019-12-04 08:08:00
1.设置IP ifconfig ip addr setup vi /etc/sysconfig/network-scripts/ifcfg-en* /etc/init.d/network start|stop|restart 重启网络服务 service network restart centos7配置静态ip后仍然显示动态ip 2.别名设置 vi ~/.bashrc 让别名文件直接生效 source ~/.bashrc 3.光盘挂载卸载 mount /dev/sr0 /mnt/cdrom umount /mnt/cdrom 4.自启动配置文件 vi /etc/rc.d/rc.local vi /etc/rc.d/rc.local touch /var/lock/subsys/local #/usr/local/nginx/sbin/nginx #/usr/local/php/sbin/php-fpm #/ust/local/memcahed/bin/memcached -p 11211 -m 128 -u root & #/usr/local/redis/redis-server /ust/local/redis/redis.conf & 5.文件权限 chmod -R 777 文件名 chmod +w filename chown -R www filename [www

Unzip buffer with Python?

别来无恙 提交于 2019-12-04 06:12:11
I have a buffer of bytes read from a library call and I would like to unzip the content which is a single text file. I tried with zlib , but I get this error: >>> import zlib >>> zlib.decompress(buffer) error: Error -3 while decompressing data: incorrect header check However with ZipFile it works, but I have to use a temporary file: import zipfile f = open('foo.zip', 'wb') f.write(buffer) f.close() z = ZipFile('foo.zip') z.extractall() z.close() with open('foo.txt', 'r') as f: uncompressed_buffer = f.read() Is it possible to use zlib and how can I avoid using a temporary file? Is it possible