/**
* 无需解压直接读取Zip文件和文件内容
*
* @param file
* @throws Exception
*/
public static InputStream readZipFile(String file) throws Exception {
InputStream input = null;
ZipFile zf = new ZipFile(file);
InputStream in = new BufferedInputStream(new FileInputStream(file));
ZipInputStream zin = new ZipInputStream(in);
ZipEntry ze;
while ((ze = zin.getNextEntry()) != null) {
if (ze.isDirectory()) {
// Do nothing
} else {
if (ze.getName().equals("map.xml")) {
input = zf.getInputStream(ze);
}
}
}
zin.closeEntry();
return input;
}
android 在不解压压缩文件的情况下,读取压缩文件内容
最新推荐文章于 2024-08-03 09:30:00 发布