android 解壓.Z字尾的壓縮包
http://www.oschina.net/news/48067/apache-commons-compress-1-7
這是查到的資料
最近接受了一個新任務中,有一項功能要處理.Z字尾的壓縮包 上網搜尋一段時間。 Commons Compress 1.7 這個開源是可以滿足解壓.Z字尾的壓縮包的,而且它還支援解壓多種格式的壓縮包。
private static File upZipFile(File file) {
FileOutputStream out = null;
ZCompressorInputStream zIn = null;
try { FileInputStream fin = new FileInputStream(file);
BufferedInputStream in = new BufferedInputStream(fin);
String name = file.getName().substring(0, file.getName().indexOf("."));
File outFile = new File("/mnt/sdcard/" + name.substring(0,4));
fos = new FileOutputStream(outFile);
zcis = new ZCompressorInputStream(in);
final byte[] buffer = new byte[2048];
int n = 0;
while (-1 != (n = zIn.read(buffer))) {
fos.write(buffer, 0, n);
}
success = true;
return outFile;
} catch (Exception e) {
e.printStackTrace();
return null; } finally {
try {
fos.close();
zcis.close();
} catch (IOException e) {
e.printStackTrace();
} } }
先後匯入了commons-compress-1.7.jar和commons-compress-1.10.jar試驗都可以成功完成解壓