Helius
2022-07-04 5f72ec020fc003d4b3d681e52c1f977ff1f3b95c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.xcong.farmer.cms.common.utils;
 
import java.io.File;
import java.io.IOException;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
 
/**
 * @author wzy
 * @date 2022-07-04
 **/
public class FileUtils {
 
    public static String path(String path) {
        if (!path.endsWith("/")) {
            return path + "/";
        }
 
        return path;
    }
 
    public static String path(String path, String fileName) {
        File file = new File(path);
        if (!file.isDirectory()){
            return "";
        }
 
        String dir = path(path);
        return dir + fileName;
    }
 
    public static void zipUpload(File file, String templateDir, String staticDir) throws IOException {
        ZipFile zipFile = new ZipFile(file);
 
        Enumeration<? extends ZipEntry> entries = zipFile.entries();
        if (entries.hasMoreElements()) {
            ZipEntry zipEntry = entries.nextElement();
            if (zipEntry.isDirectory()) {
//                zipEntry.
            }
            System.out.println(zipEntry.getName());
        }
    }
}