|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>
org.springframework.batch.item.file.FlatFileItemReader<T>
public class FlatFileItemReader<T>
Restartable ItemReader that reads lines from input
setResource(Resource). Line is defined by the
setRecordSeparatorPolicy(RecordSeparatorPolicy) and mapped to item
using setLineMapper(LineMapper).
| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_CHARSET
|
| Constructor Summary | |
|---|---|
FlatFileItemReader()
|
|
| Method Summary | |
|---|---|
void |
afterPropertiesSet()
|
protected void |
doClose()
Close the resources opened in AbstractItemCountingItemStreamItemReader.doOpen(). |
protected void |
doOpen()
Open resources necessary to start reading input. |
protected T |
doRead()
Read next item from input. |
protected void |
jumpToItem(int itemIndex)
Move to the given item index. |
void |
setComments(java.lang.String[] comments)
Setter for comment prefixes. |
void |
setEncoding(java.lang.String encoding)
Setter for the encoding for this input source. |
void |
setLineMapper(LineMapper<T> lineMapper)
Setter for line mapper. |
void |
setLinesToSkip(int linesToSkip)
Public setter for the number of lines to skip at the start of a file. |
void |
setRecordSeparatorPolicy(RecordSeparatorPolicy recordSeparatorPolicy)
Public setter for the recordSeparatorPolicy. |
void |
setResource(org.springframework.core.io.Resource resource)
Public setter for the input resource. |
void |
setSkippedLinesCallback(LineCallbackHandler skippedLinesCallback)
|
void |
setStrict(boolean strict)
In strict mode the reader will throw an exception on AbstractItemCountingItemStreamItemReader.open(org.springframework.batch.item.ExecutionContext) if the
input resource does not exist. |
| Methods inherited from class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader |
|---|
close, getCurrentItemCount, 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 |
| Field Detail |
|---|
public static final java.lang.String DEFAULT_CHARSET
| Constructor Detail |
|---|
public FlatFileItemReader()
| Method Detail |
|---|
public void setStrict(boolean strict)
AbstractItemCountingItemStreamItemReader.open(org.springframework.batch.item.ExecutionContext) if the
input resource does not exist.
strict - false by defaultpublic void setSkippedLinesCallback(LineCallbackHandler skippedLinesCallback)
skippedLinesCallback - will be called for each one of the initial
skipped lines before any items are read.public void setLinesToSkip(int linesToSkip)
linesToSkip - the number of lines to skippublic void setLineMapper(LineMapper<T> lineMapper)
lineMapper - maps line to itempublic void setEncoding(java.lang.String encoding)
DEFAULT_CHARSET.
encoding - a properties object which possibly contains the encoding
for this input file;public void setComments(java.lang.String[] comments)
comments - an array of comment line prefixes.public void setResource(org.springframework.core.io.Resource resource)
setResource in interface ResourceAwareItemReaderItemStream<T>public void setRecordSeparatorPolicy(RecordSeparatorPolicy recordSeparatorPolicy)
recordSeparatorPolicy - the recordSeparatorPolicy to set
protected T doRead()
throws java.lang.Exception
AbstractItemCountingItemStreamItemReader
doRead in class AbstractItemCountingItemStreamItemReader<T>setRecordSeparatorPolicy(RecordSeparatorPolicy) (might span
multiple lines in file).
java.lang.Exception
protected void doClose()
throws java.lang.Exception
AbstractItemCountingItemStreamItemReaderAbstractItemCountingItemStreamItemReader.doOpen().
doClose in class AbstractItemCountingItemStreamItemReader<T>java.lang.Exception
protected void doOpen()
throws java.lang.Exception
AbstractItemCountingItemStreamItemReader
doOpen in class AbstractItemCountingItemStreamItemReader<T>java.lang.Exception
protected void jumpToItem(int itemIndex)
throws java.lang.Exception
AbstractItemCountingItemStreamItemReaderAbstractItemCountingItemStreamItemReader.doRead().
jumpToItem in class AbstractItemCountingItemStreamItemReader<T>java.lang.Exception
public void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||