whycxzp
2024-01-03 6e4cf5045cb931cd375e5c7ee76cfe199a292890
src/main/java/com/whyc/service/ZipAndRarService.java
@@ -1,10 +1,12 @@
package com.whyc.service;
import com.github.junrar.exception.RarException;
import com.whyc.dto.FileDirPath;
import com.whyc.dto.Response;
import com.whyc.pojo.FileMessage;
import com.whyc.util.FileUtil;
import com.whyc.util.ZipAndRarUtil;
import org.apache.commons.compress.archivers.ArchiveException;
import org.springframework.stereotype.Service;
import java.io.IOException;
@@ -33,7 +35,7 @@
        return new Response().setII(1,list!=null,list,"压缩文件信息");
    }
    public Response decompress(String compressedFileUrl) {
    public Response decompress(String compressedFileUrl) throws ArchiveException, IOException, RarException {
        String fileSuffix = (compressedFileUrl.substring(compressedFileUrl.lastIndexOf(".")+1));
        List<String> resList = new LinkedList<>();
        if(fileSuffix.equals("zip")||fileSuffix.equals("rar")) {