public class ExcelRowByRowReader<T> extends AbstractReader<org.apache.poi.ss.usermodel.Row,T,Long>
FileInputStream
straight into memory.Process.Event, Process.EventPoint
Modifier and Type | Field and Description |
---|---|
protected int |
TIMEOUT_LOAD_IO_SECONDS
The time it should load the file in
|
protected Iterator<org.apache.poi.ss.usermodel.Row> |
worksheetRowIter |
exceptions, failFast, filter, hasNext, index, messages, params, paused, resource, transformer
listeners, processState
Constructor and Description |
---|
ExcelRowByRowReader()
Default Constructor to allow lazy initialization
If so, init() must be called by the calling API explicitly after calling BaseIterativeProcessor.setResource(Resource) |
ExcelRowByRowReader(org.springframework.core.io.Resource resource) |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Un-initialize reader, so that it maybe re consumed
Except for the main Resource & configuration set by Spring context
all other instance variables used will be re-set/disposed/cleared. |
protected boolean |
filter(org.apache.poi.ss.usermodel.Row tuple)
A false will filter out the record, i.e.
|
Long |
getCurrentRawIndex(org.apache.poi.ss.usermodel.Row row)
Get the raw index/position on the source;
BaseIterativeProcessor.getCurrentIndex() only tracks the relevant position. |
Long |
getState()
Get current state of process
|
int |
getTIMEOUT_LOAD_IO_SECONDS()
The time it should load the file in
|
org.apache.poi.ss.usermodel.Sheet |
getWorksheet() |
int |
getWorksheetIndex()
One reader can be assigned to one worksheet.
|
boolean |
hasNext()
True if there is another record that can be read by the parser, false implies end of parse/read
|
void |
init()
Allow lazy initialization of Reader in cases where the resource may not be known @
PostConstruct time |
boolean |
isInitialized()
Allow the calling API to determine if the reader has been initialized via
RealTimeLineReader.init() or PostConstruct phase
If not RealTimeLineReader.init() should be called upon the instance. |
protected org.apache.poi.ss.usermodel.Row |
nextRecord() |
protected org.apache.poi.ss.usermodel.Workbook |
readBookTypeFromResource()
Determine the resource type, from extension XLS (HSSF format) or XLSX type Defaults to XSSF format (XSSF)
|
void |
resume() |
void |
resumeFromState(Long state)
Resume process from the given State provided
|
void |
setTIMEOUT_LOAD_IO_SECONDS(int tIMEOUT_LOAD_IO_SECONDS)
The time it should load the file in
|
void |
setWorksheetIndex(int worksheetIndex)
One reader can be assigned to one worksheet.
|
Long |
size()
Get number of tuples/records in resource
|
close, getCurrentIndex, getCurrentTupleIdentifier, getExceptions, getFilter, getId, getMessages, getMeta, getParams, getResource, getSourceLocation, getTransformer, handleMiscException, isFailFast, isPaused, kill, next, nextTupleResult, pause, remove, setExceptions, setFailFast, setFilter, setId, setMessages, setMeta, setParams, setResource, setTransformer, stop, transform
addListener, getListeners, onChangeHandler, setListeners
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
protected transient Iterator<org.apache.poi.ss.usermodel.Row> worksheetRowIter
protected int TIMEOUT_LOAD_IO_SECONDS
public ExcelRowByRowReader(org.springframework.core.io.Resource resource)
public ExcelRowByRowReader()
init()
must be called by the calling API explicitly after calling BaseIterativeProcessor.setResource(Resource)
protected org.apache.poi.ss.usermodel.Workbook readBookTypeFromResource() throws IOException
poiFs
- as POIFSFileSystem
IOException
@PostConstruct public void init() throws IOException, Exception
RealTimeLineReader
PostConstruct
timeinit
in interface RealTimeLineReader<T>
init
in class BaseIterativeProcessor<org.apache.poi.ss.usermodel.Row,T,Long>
Exception
IOException
protected boolean filter(org.apache.poi.ss.usermodel.Row tuple)
BaseIterativeProcessor
filter
in class BaseIterativeProcessor<org.apache.poi.ss.usermodel.Row,T,Long>
tuple
- as public int getWorksheetIndex()
public void setWorksheetIndex(int worksheetIndex)
public void dispose()
RealTimeLineReader
Resource
& configuration set by Spring context
all other instance variables used will be re-set/disposed/cleared.public boolean isInitialized() throws Exception
RealTimeLineReader
RealTimeLineReader.init()
or PostConstruct
phase
RealTimeLineReader.init()
should be called upon the instance.Exception
public boolean hasNext()
RealTimeLineReader
hasNext
in interface RealTimeLineReader<T>
hasNext
in interface Iterator<T>
hasNext
in class BaseIterativeProcessor<org.apache.poi.ss.usermodel.Row,T,Long>
public void resume() throws Exception
resume
in interface ControllableProcess<Long>
resume
in class BaseIterativeProcessor<org.apache.poi.ss.usermodel.Row,T,Long>
Exception
protected org.apache.poi.ss.usermodel.Row nextRecord()
nextRecord
in class BaseIterativeProcessor<org.apache.poi.ss.usermodel.Row,T,Long>
public Long size()
ResourceAwareRealTimeLineReader
public void resumeFromState(Long state) throws Exception
ControllableProcess
Exception
public Long getCurrentRawIndex(org.apache.poi.ss.usermodel.Row row)
BaseIterativeProcessor
BaseIterativeProcessor.getCurrentIndex()
only tracks the relevant position.
This method allows us to get the position on the source.
BaseIterativeProcessor.getCurrentIndex()
getCurrentRawIndex
in class BaseIterativeProcessor<org.apache.poi.ss.usermodel.Row,T,Long>
public Long getState()
ControllableProcess
public org.apache.poi.ss.usermodel.Sheet getWorksheet()
public int getTIMEOUT_LOAD_IO_SECONDS()
public void setTIMEOUT_LOAD_IO_SECONDS(int tIMEOUT_LOAD_IO_SECONDS)
Copyright © 2018. All rights reserved.