
@Named @Dependent public class CsvItemReader extends CsvItemReaderWriterBase implements javax.batch.api.chunk.ItemReader
javax.batch.api.chunk.ItemReader that reads from a CSV resource into a user-defined
bean, java.util.List<String>, or java.util.Map<String, String>. Data files delimited with characters
other than comma (e.g., tab, |) are also supported by configuring preference, delimiterChar,
or quoteChar properties in job xml.
This class is not designed to be thread-safe and its instance should not be shared between threads.CsvItemReaderWriterBase,
CsvItemWriter| Modifier and Type | Field and Description |
|---|---|
protected org.supercsv.io.ICsvReader |
delegateReader |
protected int |
end
Specify the end position in the data set (inclusive).
|
protected boolean |
headerless
Indicates that the input CSV resource does not contain header row.
|
protected int |
start
Specifies the start position (a positive integer starting from 1) to read the data.
|
beanType, cellProcessorInstances, cellProcessors, charset, commentMatcher, delimiterChar, encoder, endOfLineSymbols, nameMapping, preference, quoteChar, quoteMode, surroundingSpacesNeedQuotesNEW_LINE, resource, skipBeanValidation| Constructor and Description |
|---|
CsvItemReader() |
| Modifier and Type | Method and Description |
|---|---|
Integer |
checkpointInfo() |
void |
close() |
void |
open(Serializable checkpoint) |
Object |
readItem() |
getCellProcessors, getCommentMatcher, getCsvPreference, getEncoder, getNameMapping, getQuoteModegetInputStream, getOutputStream, getValidator, validate@Inject protected int start
@Inject protected int end
Integer.MAX_VALUE.
If reading till the end of the input CSV, there is no need to specify this property.@Inject protected boolean headerless
true or false, and the default is false.protected org.supercsv.io.ICsvReader delegateReader
public void open(Serializable checkpoint) throws Exception
open in interface javax.batch.api.chunk.ItemReaderExceptionpublic void close()
throws Exception
close in interface javax.batch.api.chunk.ItemReaderExceptionpublic Object readItem() throws Exception
readItem in interface javax.batch.api.chunk.ItemReaderExceptionCopyright © 2018 JBoss by Red Hat. All rights reserved.