@@ -0,0 +1,1668 @@
+package me.solby.ifile.excel.common;%0A%0Aimport me.solby.ifile.excel.exception.ExcelException;%0Aimport org.apache.poi.hssf.usermodel.HSSFWorkbook;%0Aimport org.apache.poi.ss.usermodel.Workbook;%0Aimport org.apache.poi.xssf.usermodel.XSSFWorkbook;%0A%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.util.Arrays;%0A%0A/**%0A * me.solby.ifile.excel.common%0A *%0A * @author majhdk%0A * @date 2019-08-10%0A */%0Apublic enum ExcelFormatEnum %7B%0A%0A    /**%0A     * hssf-2003%E5%8F%8A%E4%BB%A5%E4%B8%8B%E7%89%88%E6%9C%AC%0A     */%0A    EXCEL_HSSF(%22.xls%22) %7B%0A        @Override%0A        public Workbook getWorkBook(InputStream is) %7B%0A            try (is) %7B%0A                return new HSSFWorkbook(is);%0A            %7D catch (IOException e) %7B%0A                throw new ExcelException(%22Get HSSF workbook error %22, e);%0A            %7D%0A        %7D%0A    %7D,%0A%0A    /**%0A     * xssf-2007%E5%8F%8A%E4%BB%A5%E4%B8%8A%E7%89%88%E6%9C%AC%0A     */%0A    EXCEL_XSSF(%22.xlsx%22) %7B%0A        @Override%0A        public Workbook getWorkBook(InputStream is) %7B%0A            try (is) %7B%0A                return new XSSFWorkbook(is);%0A            %7D catch (IOException e) %7B%0A                throw new ExcelException(%22Get XSSF workbook error %22, e);%0A            %7D%0A        %7D%0A    %7D,%0A    ;%0A%0A    private String suffix;%0A%0A    ExcelFormatEnum(String suffix) %7B%0A        this.suffix = suffix;%0A    %7D%0A%0A    public static ExcelFormatEnum suffixOf(String suffix) %7B%0A        return Arrays.stream(ExcelFormatEnum.values())%0A                .filter(it -%3E suffix.equals(it.getSuffix()))%0A                .findFirst()%0A                .orElseThrow(() -%3E new ExcelException(%22Invalid excel format%22));%0A    %7D%0A%0A    public String getSuffix() %7B%0A        return suffix;%0A    %7D%0A%0A    public Workbook getWorkBook(InputStream is) %7B%0A        return null;%0A    %7D%0A%0A%7D%0A

add class