Package com.opencsv
Class CSVIterator
- java.lang.Object
-
- com.opencsv.CSVIterator
-
- All Implemented Interfaces:
java.util.Iterator<java.lang.String[]>
public class CSVIterator extends java.lang.Object implements java.util.Iterator<java.lang.String[]>
Provides an Iterator over the data found in opencsv.Fair warning! This mechanism of getting at the data opencsv delivers has limitations when used with the opencsv annotations. Locales and custom converters are not supported. Further features may or may not work.
-
-
Constructor Summary
Constructors Constructor Description CSVIterator(CSVReader reader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
Returns true if the iteration has more elements.java.lang.String[]
next()
Returns the next element in the iterator.void
remove()
This method is not supported by opencsv and will throw anUnsupportedOperationException
if called.void
setErrorLocale(java.util.Locale errorLocale)
Sets the locale for error messages.
-
-
-
Constructor Detail
-
CSVIterator
public CSVIterator(CSVReader reader) throws java.io.IOException, CsvValidationException
- Parameters:
reader
- Reader for the CSV data.- Throws:
java.io.IOException
- If unable to read data from the reader.CsvValidationException
- if custom defined validator fails.
-
-
Method Detail
-
setErrorLocale
public void setErrorLocale(java.util.Locale errorLocale)
Sets the locale for error messages.- Parameters:
errorLocale
- Locale for error messages. If null, the default locale is used.- Since:
- 4.0
-
hasNext
public boolean hasNext()
Returns true if the iteration has more elements. In other words, returns true ifnext()
would return an element rather than throwing an exception.- Specified by:
hasNext
in interfacejava.util.Iterator<java.lang.String[]>
- Returns:
- True if the CSVIterator has more elements.
-
next
public java.lang.String[] next()
Returns the next element in the iterator.- Specified by:
next
in interfacejava.util.Iterator<java.lang.String[]>
- Returns:
- The next element of the iterator.
-
remove
public void remove()
This method is not supported by opencsv and will throw anUnsupportedOperationException
if called.- Specified by:
remove
in interfacejava.util.Iterator<java.lang.String[]>
-
-