All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.houbb.iexcel.hutool.util.ExcelHelper Maven / Gradle / Ivy

There is a newer version: 1.6.0
Show newest version
package com.github.houbb.iexcel.hutool.util;

import com.github.houbb.iexcel.hutool.bs.ExcelBs;
import com.github.houbb.iexcel.hutool.support.sax.SaxReadHandler;

import java.io.File;
import java.util.List;

/**
 * @author binbin.hou
 * @since 1.0.0
 */
public final class ExcelHelper {

    private ExcelHelper() {
    }

    /**
     * 读大文件
     *
     * @param file       文件
     * @param tClass     类
     * @param rowHandler 处理类
     * @param         泛型
     * @since 1.2.0
     */
    public static  void readBySax(Class tClass, SaxReadHandler rowHandler, File file) {
        ExcelBs excelBs = new ExcelBs<>();
        excelBs.readBySax(tClass, rowHandler, file);
    }

    /**
     * 读大文件
     *
     * @param tClass     类
     * @param rowHandler 处理类
     * @param filePath   文件路径
     * @param         泛型
     * @since 1.2.0
     */
    public static  void readBySax(Class tClass, SaxReadHandler rowHandler, String filePath) {
        readBySax(tClass, rowHandler, new File(filePath));
    }

    /**
     * 读取对象列表
     *
     * @param file   文件
     * @param tClass 类
     * @param     泛型
     * @return 结果
     */
    @SuppressWarnings("all")
    public static  List readList(Class tClass, File file) {
        ExcelBs excelBs = new ExcelBs<>();
        return excelBs.readList(tClass, file);
    }

    /**
     * 读取对象列表
     *
     * @param tClass 类
     * @param filePath   文件
     * @param     泛型
     * @return 结果
     */
    @SuppressWarnings("all")
    public static  List readList(Class tClass, String filePath) {
        ExcelBs excelBs = new ExcelBs<>();
        return excelBs.readList(tClass, new File(filePath));
    }

    /**
     * 写出文件
     *
     * @param list     列表
     * @param destFile 目标文件
     * @param  泛型
     */
    @SuppressWarnings("all")
    public static  void writeList(List list, File destFile) {
        ExcelBs excelBs = new ExcelBs<>();
        excelBs.writeList(list, destFile);
    }

    /**
     * 写出文件
     *
     * @param list     列表
     * @param destFilePath 目标文件
     * @param  泛型
     */
    @SuppressWarnings("all")
    public static  void writeList(List list, String destFilePath) {
        writeList(list, new File(destFilePath));
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy