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

voidunzipToFolder(final InputStream inputStream, final File outputFolder)
unzip To Folder
try (ZipInputStream zipInputstream = new ZipInputStream(inputStream)) {
    extractZipEntries(zipInputstream, outputFolder);
voidunzipToFolder(String folderPath, InputStream source)
unzip To Folder
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
File mavenHome = new File(folderPath);
if (!mavenHome.exists()) {
    try (ZipInputStream zio = new ZipInputStream(source)) {
        ZipEntry ze;
        while ((ze = zio.getNextEntry()) != null) {
            if (ze.isDirectory()) {
                new File(mavenHome, ze.getName()).mkdirs();
...
voidunzipToFolder(ZipInputStream zipInputStream, File dirToExtractTo)
Unzips the given ZipInputStream to the given folder.
Assert.isLegal(zipInputStream != null);
Assert.isLegal(!dirToExtractTo.exists() || dirToExtractTo.isDirectory());
try {
    for (ZipEntry zipEntry = null; (zipEntry = zipInputStream.getNextEntry()) != null;) {
        File file = new File(dirToExtractTo, zipEntry.getName());
        if (zipEntry.isDirectory()) {
            if (!file.exists()) {
                file.mkdirs();
...
CollectionunzipZipFile(ZipFile zip, String directory)
unzip Zip File
Collection<String> returnCollection = new ArrayList<String>();
Enumeration<ZipEntry> entries = (Enumeration<ZipEntry>) zip.entries();
while (entries.hasMoreElements()) {
    ZipEntry entry = (ZipEntry) entries.nextElement();
    copyInputStream(zip.getInputStream(entry), new BufferedOutputStream(
            new FileOutputStream(directory + System.getProperty("file.separator") + entry.getName())));
    returnCollection.add(entry.getName());
zip.close();
return returnCollection;