内容简介:Apache Commons Compress 1.18 已发布,这是一个 Bug 修复版本, ZIP 软件包的其中一项更改修复了一个可以被用作拒绝服务攻击的漏洞。 下载地址:http://commons.apache.org/proper/commons-compress/download_co...
Apache Commons Compress 1.18 已发布,这是一个 Bug 修复版本, ZIP 软件包的其中一项更改修复了一个可以被用作拒绝服务攻击的漏洞。
下载地址:http://commons.apache.org/proper/commons-compress/download_compress.cgi
其它一些新特性
New features:
It is now possible to specify the arguments of zstd-jni's ZstdOutputStream constructors via Commons Compress as well.
Fixed Bugs:
The example Expander class has been vulnerable to a path traversal in the edge case that happens when the target directory has a sibling directory and the name of the target directory is a prefix of the sibling directory's name.
Changed the OSGi Import-Package to also optionally import javax.crypto so encrypted archives can be read.
Changed various implementations of the close method to better ensure all held resources get closed even if exceptions are thrown during the closing the stream.
ZipArchiveInputStream can now detect the APK Signing Block used in signed Android APK files and treats it as an "end of archive" marker.
The cpio streams didn't handle archives using a multi-byte encoding properly.
ZipArchiveInputStream#read would silently return -1 on a corrupted stored entry and even return > 0 after hitting the end of the archive.
ArArchiveInputStream#read would allow to read from the stream without opening an entry at all.
Commons Compress 用以实现将文件压缩或解压成 tar、zip、bzip2 等格式。
下面代码将文件压缩成zip格式:
ArArchiveEntry entry = new ArArchiveEntry(name, size); arOutput.putArchiveEntry(entry); arOutput.write(contentOfEntry); arOutput.closeArchiveEntry();
Zip文件的解压缩:
ArArchiveEntry entry = (ArArchiveEntry) arInput.getNextEntry(); byte[] content = new byte[entry.getSize()]; LOOP UNTIL entry.getSize() HAS BEEN READ { arInput.read(content, offset, content.length - offset); }
【声明】文章转载自:开源中国社区 [http://www.oschina.net]
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- NPM包(模块)发布、更新、撤销发布
- 有赞灰度发布与蓝绿发布实践
- 【重磅发布】Linkis 0.10.0 版本发布
- BeetlSQL 3.0.9 发布,Idea 插件发布
- 贝密游戏 0.7.0 发布,发布斗地主
- 【重磅发布】DataSphere Studio 0.9.0 版本发布
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
首席产品官2 从白领到金领
车马 / 机械工业出版社 / 79元
《首席产品官》共2册,旨在为产品新人成长为产品行家,产品白领成长为产品金领,最后成长为首席产品官(CPO)提供产品认知、能力体系、成长方法三个维度的全方位指导。 作者在互联网领域从业近20年,是中国早期的互联网产品经理,曾是周鸿祎旗下“3721”的产品经理,担任CPO和CEO多年。作者将自己多年来的产品经验体系化,锤炼出了“产品人的能力杠铃模型”(简称“杠铃模型”),简洁、直观、兼容性好、实......一起来看看 《首席产品官2 从白领到金领》 这本书的介绍吧!
JS 压缩/解压工具
在线压缩/解压 JS 代码
图片转BASE64编码
在线图片转Base64编码工具