public abstract class BaseExcelReader<K,T> extends Object implements SafeCloseable, Iterable<T>
Modifier and Type | Field and Description |
---|---|
protected Consumer<T> |
consumer
读取的消费器
|
protected int |
currentIndex
迭代器索引
|
protected boolean |
end
是否已经读取完毕
|
protected boolean |
init
是否已经初始化
|
protected Iterator<org.apache.poi.ss.usermodel.Row> |
iterator
行迭代器
|
protected int |
lines
总行数
|
protected Map<K,ImportFieldOption> |
options
配置信息
key: key
value: 配置
|
protected PictureParser |
pictureParser
图片解析器
|
protected int |
rowIndex
行索引
|
protected int |
rowNum
读取的行
|
protected List<T> |
rows
读取的记录
|
protected org.apache.poi.ss.usermodel.Sheet |
sheet |
protected boolean |
store
是否存储数据
|
protected boolean |
streaming
是否为流式读取
|
protected boolean |
trim
是否清除空格
|
protected org.apache.poi.ss.usermodel.Workbook |
workbook |
Modifier | Constructor and Description |
---|---|
protected |
BaseExcelReader(org.apache.poi.ss.usermodel.Workbook workbook,
org.apache.poi.ss.usermodel.Sheet sheet,
List<T> rows,
Consumer<T> consumer) |
Modifier and Type | Method and Description |
---|---|
protected void |
addOption(K k,
ImportFieldOption option)
添加配置
|
protected boolean |
checkHasPicture()
检查是否包含图片
|
protected void |
checkInit()
检查是否初始化
|
protected void |
checkStreamingSupportType(ExcelReadType type)
检查是否为streaming支持的类型
|
BaseExcelReader<K,T> |
clear()
清空读取的行
|
void |
close()
安全关闭
|
int |
getLines() |
protected byte[] |
getPicture(int col,
org.apache.poi.ss.usermodel.Row row)
获取图片
|
int |
getRowNum() |
List<T> |
getRows() |
org.apache.poi.ss.usermodel.Sheet |
getSheet() |
org.apache.poi.ss.usermodel.Workbook |
getWorkbook() |
BaseExcelReader<K,T> |
init()
初始化 默认实现
|
ExcelReaderIterator<T> |
iterator()
excel 迭代器 不会存储也不会消费
|
protected T |
nextRow()
读取一行
|
protected abstract T |
parserRow(org.apache.poi.ss.usermodel.Row row)
解析行
|
BaseExcelReader<K,T> |
read()
读取所有行
|
BaseExcelReader<K,T> |
read(int i)
读取多行
|
protected void |
readRow()
读取一行
|
BaseExcelReader<K,T> |
recalculationFormula()
重新计算所有公式
|
BaseExcelReader<K,T> |
skip()
跳过一行
|
BaseExcelReader<K,T> |
skip(int i)
跳过多行
|
BaseExcelReader<K,T> |
trim()
是否清除空格
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
protected org.apache.poi.ss.usermodel.Workbook workbook
protected org.apache.poi.ss.usermodel.Sheet sheet
protected Iterator<org.apache.poi.ss.usermodel.Row> iterator
protected int currentIndex
protected int rowIndex
protected int rowNum
protected int lines
protected boolean end
protected boolean trim
String
protected boolean streaming
protected boolean store
protected Map<K,ImportFieldOption> options
protected PictureParser pictureParser
protected boolean init
public ExcelReaderIterator<T> iterator()
public BaseExcelReader<K,T> init()
public BaseExcelReader<K,T> skip()
public BaseExcelReader<K,T> skip(int i)
i
- 行public BaseExcelReader<K,T> trim()
public BaseExcelReader<K,T> recalculationFormula()
public BaseExcelReader<K,T> read()
public BaseExcelReader<K,T> read(int i)
i
- 行public BaseExcelReader<K,T> clear()
protected void readRow()
protected T nextRow()
protected abstract T parserRow(org.apache.poi.ss.usermodel.Row row)
row
- rowprotected void checkInit()
protected boolean checkHasPicture()
protected void checkStreamingSupportType(ExcelReadType type)
type
- typeprotected void addOption(K k, ImportFieldOption option)
k
- koption
- 配置protected byte[] getPicture(int col, org.apache.poi.ss.usermodel.Row row)
col
- 列row
- 行public void close()
SafeCloseable
close
in interface SafeCloseable
close
in interface Closeable
close
in interface AutoCloseable
public org.apache.poi.ss.usermodel.Workbook getWorkbook()
public org.apache.poi.ss.usermodel.Sheet getSheet()
public int getRowNum()
public int getLines()
Copyright © 2024. All rights reserved.