类 AxolotlStreamExcelReader<T>
java.lang.Object
cn.toutatis.xvoid.axolotl.excel.reader.support.AxolotlAbstractExcelReader<T>
cn.toutatis.xvoid.axolotl.excel.reader.AxolotlStreamExcelReader<T>
- 类型参数:
T- 转换实体
Excel流形式读取器
大文件读取时,推荐使用流形式读取器,相比于AxolotlExcelReader内存占用实际上没什么区别,但是读取速度更快。
对于AxolotlStreamExcelReader读取数据时,少了很多特性支持,不支持分页等,因为流形式读取器读取时,不会将整个文件读入内存。
流支持基于excel-streaming-reader,并且该流读取器只支持xlsx格式
excel-streaming-reader在底层使用了一些Apache POI代码。该代码在处理xlsx时使用内存和/或临时文件来存储临时数据。对于非常大的文件,您可能希望使用临时文件。
对于StreamingReader.builder(),不要设置setAvoidTempFiles(true)。您还应该考虑调优POI设置。具体来说,请考虑设置这些属性:
ZipInputStreamZipEntrySource.setThresholdBytesForTempFiles(16384); //16KB
ZipPackage.setUseTempFilePackageParts(true);
- 从以下版本开始:
- 0.0.9-ALPHA-1
- 作者:
- Toutatis_Gc
-
字段概要
从类继承的字段 cn.toutatis.xvoid.axolotl.excel.reader.support.AxolotlAbstractExcelReader
_sheetLevelReaderConfig, validator, workBookContext -
构造器概要
构造器构造器说明AxolotlStreamExcelReader(File excelFile) AxolotlStreamExcelReader(File excelFile, boolean withDefaultConfig) AxolotlStreamExcelReader(File excelFile, Class<T> clazz) AxolotlStreamExcelReader(File excelFile, Class<T> clazz, boolean withDefaultConfig) AxolotlStreamExcelReader(InputStream ins, Class<T> clazz) -
方法概要
修饰符和类型方法说明<RT> RTcastRow2Instance(org.apache.poi.ss.usermodel.Row row, ReaderConfig<RT> readerConfig) 读取行数据转换为对象protected DetectResultcheckFileFormat(File file, InputStream ins) 检查文件类型 流方式仅支持xlsx格式<RT> AxolotlExcelStream<RT>dataIterator(ReaderConfig<RT> readerConfig) 数据迭代器protected void加载大文件从类继承的方法 cn.toutatis.xvoid.axolotl.excel.reader.support.AxolotlAbstractExcelReader
adaptiveCellValue2EntityClass, adaptiveValue, assignValueToField, castValue, convertCellToInstance, convertPositionCellToInstance, createAdditionalExtensions, getBlankCellValue, getCellOriginalValue, getFileOrStreamDetectResult, getFormulaCellValue, getHumanReadablePosition, getIndexCellValue, getPhysicalRowNumber, getPhysicalRowNumber, getPositionCellOriginalValue, getRecordRowNumber, getRecordRowNumber, getRowNumber, getRowNumber, getRowNumber, preCheckAndFixReadConfig, readRow, readSheetDataAsObject, readSheetDataAsObject, row2MapInstance, row2SimplePOJO, searchHeaderCellPosition, searchSheet, spreadMergedCells, validateConvertEntity
-
构造器详细资料
-
AxolotlStreamExcelReader
-
AxolotlStreamExcelReader
-
AxolotlStreamExcelReader
-
AxolotlStreamExcelReader
-
AxolotlStreamExcelReader
-
AxolotlStreamExcelReader
-
-
方法详细资料
-
checkFileFormat
检查文件类型 流方式仅支持xlsx格式- 覆盖:
checkFileFormat在类中AxolotlAbstractExcelReader<T>- 参数:
file- 工作簿文件ins- 输入流- 返回:
- 文件检测结果
-
loadFileDataToWorkBook
protected void loadFileDataToWorkBook()加载大文件 -
castRow2Instance
读取行数据转换为对象- 类型参数:
RT- 对象类型- 参数:
row- 行readerConfig- 读取配置- 返回:
- 对象
-
dataIterator
数据迭代器- 类型参数:
RT- 对象类型- 参数:
readerConfig- 读取配置- 返回:
- 数据迭代器
-