android中的解压缩方式和java中是一样的。以下为解压缩的方法代码
public void Ectract(String sZipPathFile, String sDestPath)
{
try {
// 先指定压缩档的位置和档名,建立FileInputStream对象
FileInputStream fins = new FileInputStream(sZipPathFile);
// 将fins传入ZipInputStream中
ZipInputStream zins = new ZipInputStream(fins);
ZipEntry ze = null;
byte ch[] = new byte[8192];
while ((ze = zins.getNextEntry()) != null) {
File zfile = new File(sDestPath + ze.getName());
File fpath = new File(zfile.getParentFile().getPath());
if (ze.isDirectory()) {
if (!zfile.exists())
zfile.mkdirs();
zins.closeEntry();
} else {
if (!fpath.exists())
fpath.mkdirs();
FileOutputStream fouts = new FileOutputStream(zfile);
int i;
while ((i = zins.read(ch)) != -1)
fouts.write(ch, 0, i);
zins.closeEntry();
fouts.close();
}
}
fins.close();
zins.close();
} catch (Exception e){
e.printStackTrace();
}
}
分享到:
相关推荐
Java工具类ZIP解压缩Java工具类ZIP解压缩Java工具类ZIP解压缩
zip压缩方法,为了代码简练,笔者只保留了dynamic部分的解压缩,而把store和fixed两种压缩格式的压缩函数拿掉了,CRC校验部分的代码也拿掉了,需要的同学请根据GZIP的源代码自行加上。
只需要包含头文件,就可以进行文件的压缩和解压缩。可查看readme 或者文件中demo 简单易用。
VB.NET使用ZipPackage实现ZIP文件压缩解压缩示例
zip压缩解压缩 源代码 c++ code
java语言操作解压缩文件。 /** * 数据压缩 * * @param data * @return * @throws Exception */ public static byte[] compress(byte[] data) throws Exception { ByteArrayInputStream bais = new ...
VB中需要进行解压缩ZIP文件时,如果调用外置的winzip或者winrar始终不是很保险的做法。使用本程序中的模块及源码可以完美的解决这个问题。
提供zip解压缩工具安装包,在客户内网环境下,通常无法联网,无法使用yum安装zip,此时可以使用rpm安装包进行安装 1.将此资源包放到服务器 2.解压之后进入文件夹 3.rpm -Uvh *.rpm --nodeps --force 命令进行安装
哈夫曼压缩与解压缩源码.zip哈夫曼压缩与解压缩源码.zip哈夫曼压缩与解压缩源码.zip哈夫曼压缩与解压缩源码.zip哈夫曼压缩与解压缩源码.zip哈夫曼压缩与解压缩源码.zip哈夫曼压缩与解压缩源码.zip哈夫曼压缩与解压缩...
C++ zip压缩解压缩源代码 压缩时调用 #include "zip.h" HZIP hz = CreateZip("c:\\simple1.zip",0); ZipAdd(hz,"znsimple.bmp", "c:\\simple.bmp"); ZipAdd(hz,"znsimple.txt", "c:\\simple.txt"); ...
使用XE4自带单元System.Zip。来压缩解压,有XE4写的Exe,XE4写的Dll可供Delphi7调用。里面都有源码。
7-zip解压缩软件 可解eif fcf文件,好用的解压缩软件
ZIP解压缩实例程序,VC工程文件,可指定文件目录,设置压缩密码
使用ZLIB库 包装的压缩解压缩文件的源码 VS2005 工程创建 /* */ class ZIPWRAP_EXP CZipper { public: CZipper(); virtual ~CZipper(); // simple interface static bool ZipFile(const char* szFilePath...
java 解压缩zip文件 java 解压缩zip文件 java 解压缩zip文件
UE4、UE5引擎解压缩zip文件插件
JDK1.8 windows zip解压缩版
解决android 自带zip解压缩中文乱码的问题,导入zip.jar即可使用(与系统提供的用法相同),大小仅24k
PHP ZIP解压缩例子.以前学习用的实例,上传来给新手分享,
这个是目前最简单傻瓜式的,基于c/c++ 的压缩解压缩程序。 操作非常简单。里面有教程,有图。 有源代码。