Class StreamingXlsxItemReader<T>
java.lang.Object
org.springframework.batch.item.ItemStreamSupport
org.springframework.batch.item.support.AbstractItemStreamItemReader<T>
org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>
org.springframework.batch.extensions.excel.AbstractExcelItemReader<T>
org.springframework.batch.extensions.excel.streaming.StreamingXlsxItemReader<T>
- Type Parameters:
T- the type
- All Implemented Interfaces:
org.springframework.batch.item.file.ResourceAwareItemReaderItemStream<T>,org.springframework.batch.item.ItemReader<T>,org.springframework.batch.item.ItemStream,org.springframework.batch.item.ItemStreamReader<T>,org.springframework.beans.factory.InitializingBean
Simple streaming reader without Apache POI.
- Since:
- 0.1.0
- Author:
- Marten Deinum
-
Field Summary
Fields inherited from class org.springframework.batch.extensions.excel.AbstractExcelItemReader
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoClose()protected intThe number of sheets in the underlying workbook.protected SheetgetSheet(int sheet) Get the sheet based on the given sheet index.protected voidopenExcelFile(org.springframework.core.io.Resource resource, String password) Opens the excel file and reads the file and sheet metadata.Methods inherited from class org.springframework.batch.extensions.excel.AbstractExcelItemReader
afterPropertiesSet, doOpen, doRead, jumpToItem, read, setEndAfterBlankLines, setLinesToSkip, setPassword, setResource, setRowMapper, setRowSetFactory, setSkippedRowsCallback, setStrictMethods inherited from class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader
close, getCurrentItemCount, isSaveState, open, setCurrentItemCount, setMaxItemCount, setSaveState, updateMethods inherited from class org.springframework.batch.item.ItemStreamSupport
getExecutionContextKey, setExecutionContextName, setNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.batch.item.ItemStream
close, open, update
-
Constructor Details
-
StreamingXlsxItemReader
public StreamingXlsxItemReader()
-
-
Method Details
-
getSheet
Description copied from class:AbstractExcelItemReaderGet the sheet based on the given sheet index.- Specified by:
getSheetin classAbstractExcelItemReader<T>- Parameters:
sheet- the sheet index- Returns:
- the sheet or
nullwhen no sheet available.
-
getNumberOfSheets
protected int getNumberOfSheets()Description copied from class:AbstractExcelItemReaderThe number of sheets in the underlying workbook.- Specified by:
getNumberOfSheetsin classAbstractExcelItemReader<T>- Returns:
- the number of sheets.
-
openExcelFile
protected void openExcelFile(org.springframework.core.io.Resource resource, String password) throws Exception Description copied from class:AbstractExcelItemReaderOpens the excel file and reads the file and sheet metadata. Uses aResourceto read the sheets, this file can optionally be password protected.- Specified by:
openExcelFilein classAbstractExcelItemReader<T>- Parameters:
resource-Resourcepointing to the Excel file to readpassword- optional password- Throws:
Exception- when the Excel sheet cannot be accessed
-
doClose
- Overrides:
doClosein classAbstractExcelItemReader<T>- Throws:
Exception
-