Top Description Fields Constructors Methods
com.opencsv.bean.concurrent

public Class SingleLineReader

extends Object
Class Inheritance
Known Direct Subclasses
com.opencsv.bean.concurrent.CompleteFileReader
Imports
com.opencsv.CSVReader, com.opencsv.bean.CsvToBean, com.opencsv.exceptions.CsvValidationException, org.apache.commons.lang3.StringUtils, java.io.IOException

This class exists to isolate the logic for reading a single line of input that is common to CsvToBean#iterator() and CompleteFileReader. It is not meant for end user consumption.
Author
Andrew Rucker Jones
Since
5.2

Field Summary

Modifier and TypeField and Description
protected final CSVReader
protected final boolean
protected String[]
line

Stores the result of parsing a line of input.

Constructor Summary

AccessConstructor and Description
public
SingleLineReader(CSVReader
The CSVReader for reading the input
csvReader
,
boolean
Whether blank lines of input should be ignored
ignoreEmptyLines
)

The only constructor.

Method Summary

Modifier and TypeMethod and Description
public String[]

Returns:

A new array with the last line read
getLine
()

Returns a copy of the last line read by readNextLine().

public long
getLinesRead()

Returns: The number of lines read from the input this far

private boolean
public String[]

Returns:

The next line of significant input, or null if none remain
readNextLine
()

Reads from the CSVReader provided on instantiation until a usable line of input is found.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

csvReaderback to summary
protected final CSVReader csvReader
ignoreEmptyLinesback to summary
protected final boolean ignoreEmptyLines
lineback to summary
protected String[] line

Stores the result of parsing a line of input.

Constructor Detail

SingleLineReaderback to summary
public SingleLineReader(CSVReader csvReader, boolean ignoreEmptyLines)

The only constructor.

Parameters
csvReader:CSVReader

The CSVReader for reading the input

ignoreEmptyLines:boolean

Whether blank lines of input should be ignored

Method Detail

getLineback to summary
public String[] getLine()

Returns a copy of the last line read by readNextLine().

Returns:String[]

A new array with the last line read

getLinesReadback to summary
public long getLinesRead()
Returns:long

The number of lines read from the input this far

isCurrentLineEmptyback to summary
private boolean isCurrentLineEmpty()
readNextLineback to summary
public String[] readNextLine() throws IOException, CsvValidationException

Reads from the CSVReader provided on instantiation until a usable line of input is found.

Returns:String[]

The next line of significant input, or null if none remain

Exceptions
IOException:
If bad things happen during the read
CsvValidationException:
If a user-defined validator fails