com.github.bingoohuang.excel2maps.ExcelToMaps Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of excel2javabeans Show documentation
Show all versions of excel2javabeans Show documentation
a little utility to convert excel rows to java beans
package com.github.bingoohuang.excel2maps;
import lombok.SneakyThrows;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
public class ExcelToMaps implements Closeable {
private final Workbook workbook;
private final boolean shouldBeClosedByMe;
@SneakyThrows
public ExcelToMaps(InputStream excelInputStream) {
this.workbook = WorkbookFactory.create(excelInputStream);
this.shouldBeClosedByMe = true;
}
public ExcelToMaps(Workbook workbook) {
this.workbook = workbook;
this.shouldBeClosedByMe = false;
}
public List