解决方案 »
- Titanium开发关于FaceBook登录的android方向程序
- 请问在recevier的onReceve里面不能打Log和debug么?
- 获得系统日期时间
- android 方向传感器绕x轴转的角度和绕y轴转的角度的值能获取的小数点后几位?
- android adt 的 layout editor, 不支持style吗
- NDK可以直接操作寄存器么
- Android 开发环境 我搭建老失败
- Android"系统服务"如何读写sdcard?
- 运行cocos2 android 1 出错:Multiple dex files define Lorg/cocos2d/Cocos2D$1;
- 谁来救救我,android studio没法插入到数据库??
- 谁知道腾讯新闻里世界杯赛程魔方效果是如何实现的?
- 求大牛详细解释android Contentprovider的uri 跪谢!!!
我也不会,帮你顶一下
FileNotFoundException, ZipException { archive = CommonUtil.getRootFilePath() + archive;
String decompressDir = CommonUtil.getRootFilePath();
BufferedInputStream bi;
ZipFile zf = new ZipFile(archive, "GBK");
Enumeration e = zf.getEntries();
while (e.hasMoreElements()) {
ZipEntry ze2 = (ZipEntry) e.nextElement();
String entryName = ze2.getName();
String path = decompressDir + entryName;
if (ze2.isDirectory()) {
// System.out.println("正在创建解压目录 - " + entryName);
File decompressDirFile = new File(path);
if (!decompressDirFile.exists()) {
decompressDirFile.mkdirs();
}
} else {
// System.out.println("正在创建解压文件 - " + entryName);
String fileDir = path.substring(0, path.lastIndexOf("/"));
File fileDirFile = new File(fileDir);
if (!fileDirFile.exists()) { fileDirFile.mkdirs(); }
BufferedOutputStream bos = new BufferedOutputStream(
new FileOutputStream(decompressDir + entryName));
bi = new BufferedInputStream(zf.getInputStream(ze2));
byte[] readContent = new byte[1024];
int readCount = bi.read(readContent);
while (readCount != -1) {
bos.write(readContent, 0, readCount);
readCount = bi.read(readContent);
}
bos.close();
}
}
zf.close();
}