package com.daimafans.demo;

import net.lingala.zip4j.core.ZipFile;
import net.lingala.zip4j.exception.ZipException;

/**
 * 解压到指定文件夹
 *
 * @author daimafans.com
 * @date 2018-11-29
 */
public class UnZipFiles
{
    public static void main(String[] args)
    {
        try
        {
            ZipFile zipFile = new ZipFile("D:\\test.zip");

            // 如果解压需要密码
            if (zipFile.isEncrypted())
            {
                zipFile.setPassword("111");
            }

            zipFile.extractAll("D:\\test");
        }
        catch (ZipException e)
        {
            e.printStackTrace();
        }
    }
}