Package com.opencsv.bean.concurrent
Class SingleLineReader
- java.lang.Object
-
- com.opencsv.bean.concurrent.SingleLineReader
-
- Direct Known Subclasses:
CompleteFileReader
public class SingleLineReader extends java.lang.Object
This class exists to isolate the logic for reading a single line of input that is common toCsvToBean.iterator()
andCompleteFileReader
. It is not meant for end user consumption.- Since:
- 5.2
-
-
Field Summary
Fields Modifier and Type Field Description protected CSVReader
csvReader
protected boolean
ignoreEmptyLines
protected java.lang.String[]
line
Stores the result of parsing a line of input.
-
Constructor Summary
Constructors Constructor Description SingleLineReader(CSVReader csvReader, boolean ignoreEmptyLines)
The only constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String[]
getLine()
Returns a copy of the last line read byreadNextLine()
.long
getLinesRead()
private boolean
isCurrentLineEmpty()
java.lang.String[]
readNextLine()
Reads from theCSVReader
provided on instantiation until a usable line of input is found.
-
-
-
Field Detail
-
csvReader
protected final CSVReader csvReader
-
ignoreEmptyLines
protected final boolean ignoreEmptyLines
-
line
protected java.lang.String[] line
Stores the result of parsing a line of input.
-
-
Method Detail
-
isCurrentLineEmpty
private boolean isCurrentLineEmpty()
-
readNextLine
public java.lang.String[] readNextLine() throws java.io.IOException, CsvValidationException
Reads from theCSVReader
provided on instantiation until a usable line of input is found.- Returns:
- The next line of significant input, or
null
if none remain - Throws:
java.io.IOException
- If bad things happen during the readCsvValidationException
- If a user-defined validator fails
-
getLinesRead
public long getLinesRead()
- Returns:
- The number of lines read from the input this far
-
getLine
public java.lang.String[] getLine()
Returns a copy of the last line read byreadNextLine()
.- Returns:
- A new array with the last line read
-
-