List of utility methods to do Unzip File
java.io.InputStream | UpZip(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); |
boolean | unzipArchive(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; |
Map | UnZipFileToMem(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; |
boolean | UnZipFile(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; |
void | unZip(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(); ... |
void | unZipFromAssets(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); |