Android Utililty Methods Unzip File

List of utility methods to do Unzip File

Description

The list of methods to do Unzip File are organized into topic(s).

Method

java.io.InputStreamUpZip(String zipFileString, String fileString)
Up Zip
android.util.Log.v("XZip", "UpZip(String, String)");
java.util.zip.ZipFile zipFile = new java.util.zip.ZipFile(
        zipFileString);
java.util.zip.ZipEntry zipEntry = zipFile.getEntry(fileString);
return zipFile.getInputStream(zipEntry);
booleanunzipArchive(File archive, File outputDir)
unzip Archive
boolean result = false;
ZipFile zipfile;
try {
    zipfile = new ZipFile(archive);
    for (Enumeration e = zipfile.entries(); e.hasMoreElements();) {
        ZipEntry entry = (ZipEntry) e.nextElement();
        unzipEntry(zipfile, entry, outputDir);
    result = true;
} catch (IOException e1) {
return result;
MapUnZipFileToMem(String source)
Un Zip File To Mem
File file = new File(source);
if (file.exists() == false) {
    return null;
try {
    return UnZipFileToMem(new FileInputStream(file));
} catch (Exception e) {
return null;
booleanUnZipFile(String source, String targetPath)
Unzip a source to the targetPath, is similar with the UnZipFile(InputStream is, String targetPath)
File file = new File(source);
if (file.exists() == false) {
    return false;
try {
    return UnZipFile(new FileInputStream(file), targetPath);
} catch (Exception e) {
return false;
voidunZip(String zipFile, String destinationDirectory)
kudos: http://www.jondev.net/articles/Unzipping_Files_with_Android_(Programmatically)
try {
    FileInputStream fin = new FileInputStream(zipFile);
    ZipInputStream zin = new ZipInputStream(fin);
    ZipEntry ze = null;
    while ((ze = zin.getNextEntry()) != null) {
        Log.v("Decompress", "Unzipping " + ze.getName());
        String destinationPath = destinationDirectory
                + File.separator + ze.getName();
...
voidunZipFromAssets(Context ctx, String file, String destinationDirectory)
extracts a zip archive from the assets dir.
String destinationFilename = extractFromAssets(ctx, file,
        destinationDirectory);
try {
    unZip(destinationFilename, destinationDirectory);
} catch (Exception e) {
    throw new Exception(e);