|
BeanIO 1.2.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T> org.beanio.spring.BeanIOFlatFileItemReader<T>
T
- Class type read from the filepublic class BeanIOFlatFileItemReader<T>
A Spring Batch item reader that uses a BeanIO stream mapping file to read items from a flat file. Restart capabilities are fully supported.
This implementation requires Spring 2.5 or greater, and Spring Batch 2.1.x.
Constructor Summary | |
---|---|
BeanIOFlatFileItemReader()
Constructs a new BeanIOFlatFileItemReader. |
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
protected void |
doClose()
|
protected void |
doOpen()
|
protected T |
doRead()
|
protected void |
initializeStreamFactory()
Creates a StreamFactory if one was not set, loads the stream
mapping resource if set, and validates the StreamFactory has a
mapping for the configured stream name. |
protected void |
jumpToItem(int itemIndex)
|
void |
setEncoding(String encoding)
Sets the input stream encoding. |
void |
setErrorHandler(BeanReaderErrorHandler errorHandler)
Sets the BeanIO error handler for handling BeanIO specific exceptions. |
void |
setLocale(String locale)
Sets the locale for resolving error messages from a stream mapping's configured resource bundle. |
void |
setResource(Resource resource)
|
void |
setStreamFactory(StreamFactory streamFactory)
Sets the StreamFactory for loading stream mapping configurations. |
void |
setStreamMapping(Resource streamMapping)
Sets the mapping file resource. |
void |
setStreamName(String streamName)
Sets the mapping configuration's stream name for reading this input stream. |
void |
setStrict(boolean strict)
In strict mode this reader will throw an exception if the input resource does not exist when opened. |
void |
setUseSpringExceptions(boolean useSpringExceptions)
Set to true to force AbstractItemCountingItemStreamItemReader.read() to wrap BeanIO exceptions
to their closest Spring-batch counterpart. |
Methods inherited from class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader |
---|
close, getCurrentItemCount, getExecutionContextUserSupport, isSaveState, open, read, setCurrentItemCount, setMaxItemCount, setName, setSaveState, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.springframework.batch.item.ItemStream |
---|
close, open, update |
Methods inherited from interface org.springframework.batch.item.ItemReader |
---|
read |
Constructor Detail |
---|
public BeanIOFlatFileItemReader()
Method Detail |
---|
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
protected T doRead() throws Exception
doRead
in class AbstractItemCountingItemStreamItemReader<T>
Exception
protected void doOpen() throws Exception
doOpen
in class AbstractItemCountingItemStreamItemReader<T>
Exception
protected void doClose() throws Exception
doClose
in class AbstractItemCountingItemStreamItemReader<T>
Exception
protected void jumpToItem(int itemIndex) throws Exception
jumpToItem
in class AbstractItemCountingItemStreamItemReader<T>
Exception
protected void initializeStreamFactory() throws Exception
StreamFactory
if one was not set, loads the stream
mapping resource if set, and validates the StreamFactory has a
mapping for the configured stream name.
IllegalStateException
- if the configured stream name is not found
in the StreamFactory after loading the stream mapping
Exception
public void setResource(Resource resource)
setResource
in interface ResourceAwareItemReaderItemStream<T>
public void setStrict(boolean strict)
strict
- set to false to disable resource validationpublic void setStreamFactory(StreamFactory streamFactory)
StreamFactory
for loading stream mapping configurations. If not set,
a new default StreamFactory is created.
streamFactory
- the StreamFactory to use for loading stream
mapping configurationspublic void setStreamMapping(Resource streamMapping)
streamMapping
- the stream mapping resourcepublic void setStreamName(String streamName)
streamName
- the stream namepublic void setEncoding(String encoding)
encoding
- input stream encodingpublic void setUseSpringExceptions(boolean useSpringExceptions)
AbstractItemCountingItemStreamItemReader.read()
to wrap BeanIO exceptions
to their closest Spring-batch counterpart. Defaults to false.
useSpringExceptions
- set to true to map BeanIO exceptions
to their Spring-batch counterpartpublic void setErrorHandler(BeanReaderErrorHandler errorHandler)
AbstractItemCountingItemStreamItemReader.read()
method will throw the exception
directly.
errorHandler
- the BeanReaderErrorHandler
for handling exceptionspublic void setLocale(String locale)
locale
- the locale for resolving error messages
|
BeanIO 1.2.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |