Android - unzipping zip files that are password encoded
is it possible to unzip files that have been zipped using a password?
I have search and cannot find a开发者_运维问答ny examples or mentions in the docs.
A link to docs or code samples would be great.
Thank you,
Mike
Refer to this question:
How to unzip a password protected file in Android
It uses a zip4j lib which works perfectly fine on android:
try {
File src = new File("/sdcard/abc.zip");
ZipFile zipFile = new ZipFile(src);
if (zipFile.isEncrypted()) {
zipFile.setPassword("a");
}
String dest = new String("/sdcard/abc");
zipFile.extractAll(dest);
} catch (ZipException e) {
e.printStackTrace();
}
You are right, the java.util.zip package does not support password zipping and unzipping functionality. You have to find other ways to implement it yourself. I did help search a bit see if you find this link useful :) http://blog.alutam.com/2009/10/31/reading-password-protected-zip-files-in-java/
精彩评论