Java Utililty Methods Unzip to Folder

List of utility methods to do Unzip to Folder

Description

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

Method

voidunzip(String sourceFile, String destDir)
unzip
BufferedOutputStream dest = null;
FileInputStream fis = new FileInputStream(sourceFile);
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
ZipEntry entry = null;
int BUFFER_SIZE = 4096;
while ((entry = zis.getNextEntry()) != null) {
    String dst = destDir + File.separator + entry.getName();
    if (entry.isDirectory()) {
...
voidunzip(String sourceFile, String destDir)
unzip
final FileInputStream fis = new FileInputStream(sourceFile);
final ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
final File destDirFile = new File(destDir);
final byte[] data = new byte[BUFFER_SIZE];
ZipEntry entry;
Set<String> visitedDirs = new HashSet<>();
createDir(destDir);
while ((entry = zis.getNextEntry()) != null) {
...
voidunzip(String sourceFile, String toDir)
unzip
ZipFile zipFile = new ZipFile(sourceFile);
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
    ZipEntry entry = entries.nextElement();
    File entryDestination = new File(toDir, entry.getName());
    entryDestination.getParentFile().mkdirs();
    if (entry.isDirectory())
        entryDestination.mkdirs();
...
voidunzip(String sourceFileName, String destPath)
unzip
ZipFile zf = null;
try {
    zf = new ZipFile(sourceFileName);
    Enumeration en = zf.entries();
    while (en.hasMoreElements()) {
        ZipEntry zipEnt = (ZipEntry) en.nextElement();
        saveEntry(destPath, zipEnt, zf);
} finally {
    if (zf != null)
        zf.close();
voidunzip(String sourceZip, String targetDirectory)
unzip
FileInputStream fis = null;
BufferedInputStream bis = null;
ZipInputStream zis = null;
try {
    fis = new FileInputStream(new File(sourceZip));
    bis = new BufferedInputStream(fis);
    zis = new ZipInputStream(bis);
    for (ZipEntry ze = zis.getNextEntry(); ze != null; ze = zis.getNextEntry()) {
...
voidunzip(String src, String dest, PrintStream stream)
unzip
src = src.replace("~", System.getProperty("user.home"));
dest = dest.replace("~", System.getProperty("user.home"));
if (!new File(src).exists()) {
    throw new RuntimeException(src + " does not exist.");
ZipInputStream zis = new ZipInputStream(new CheckedInputStream(new FileInputStream(src), new CRC32()));
innerUnzip(zis, dest, stream);
zis.close();
...
voidunzip(String sZip)
Unzip file Zip (terkompresi)
byte[] buf = new byte[1024];
try {
    ZipInputStream zin = new ZipInputStream(new FileInputStream(sZip));
    ZipEntry ze;
    while ((ze = zin.getNextEntry()) != null) {
        FileOutputStream out = new FileOutputStream(ze.getName());
        int len;
        while ((len = zin.read(buf)) > 0) {
...
Stringunzip(String toUnpackName)
unzip
File file = new File(toUnpackName);
return unzip(file);
booleanunzip(String zip, String dest)
Unzip a zip file into the destination directory
return unzip(new File(zip), new File(dest));
voidunzip(String zip, String folder)
Unzips the given zip file into the given folder retaining the folder structure of the zip.
if (zip == null || zip.length() == 0 || folder == null || folder.length() == 0) {
    return;
try (ZipFile zipFile = new ZipFile(zip)) {
    Enumeration<? extends ZipEntry> entries = zipFile.entries();
    while (entries.hasMoreElements()) {
        ZipEntry entry = entries.nextElement();
        String currentEntry = entry.getName();
...