package com.ecep.contract.util;

public class FileUtils {
    public final static String PDF = ".pdf";
    public final static String DOC = ".doc";
    public final static String DOCX = ".docx";
    public final static String XLS = ".xls";
    public final static String XLSX = ".xlsx";
    public final static String PNG = ".png";
    public final static String JPG = ".jpg";
    public final static String JPEG = ".jpeg";
    public final static String JSON = ".json";
    public final static String FILE_DB_THUMBS = "Thumbs.db";
    public final static String FILE_DB_JSON = "db.json";
    public final static String FILE_BLACK_LIST_JSON = "black_list.json";
    public final static String FILE_B1001_JSON = "b1001.json";

    /**
     * 检查文件是否符合后缀要求
     *
     * @param name           文件名
     * @param fileExtensions 后缀
     */
    public static boolean withExtensions(String name, String... fileExtensions) {
        for (String fn : fileExtensions) {
            if (name.endsWith(fn)) {
                return true;
            }
        }
        return false;
    }
}
