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

io.robe.convert.excel.importer.XLSImporter Maven / Gradle / Ivy

There is a newer version: 0.5.0.0-1039
Show newest version
package io.robe.convert.excel.importer;

import io.robe.convert.common.OnItemHandler;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.InputStream;
import java.util.List;

public class XLSImporter extends ExcelImporter {

    private static Logger LOGGER = LoggerFactory.getLogger(XLSImporter.class);

    public XLSImporter(Class dataClass) {
        super(dataClass);
    }

    public XLSImporter(Class dataClass, boolean hasTitleRow) {
        super(dataClass, hasTitleRow);
    }

    @Override
    public List importStream(InputStream inputStream) throws Exception {
        return importStream(inputStream, new HSSFWorkbook(inputStream));
    }

    @Override
    public List importStream(InputStream inputStream, String charSetName) throws Exception {
        LOGGER.warn("Charset" + charSetName + " ignored, Apache poi detects encoding dynamically");
        return importStream(inputStream);
    }

    @Override
    public void importStream(InputStream inputStream, OnItemHandler handler) throws Exception {
        importStream(inputStream, new HSSFWorkbook(inputStream), handler);
    }

    @Override
    public void importStream(InputStream inputStream, OnItemHandler handler, String charSetName) throws Exception {
        LOGGER.warn("Charset" + charSetName + " ignored, Apache poi detects encoding dynamically");
        importStream(inputStream, new HSSFWorkbook(inputStream), handler);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy