Package com.opencsv

Class CSVIterator

java.lang.Object
com.opencsv.CSVIterator
All Implemented Interfaces:
Iterator<String[]>

public class CSVIterator extends Object implements Iterator<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.

  • Field Details

    • reader

      private final CSVReader reader
    • nextLine

      private String[] nextLine
    • errorLocale

      private Locale errorLocale
      Locale for all translations.
  • Constructor Details

  • Method Details

    • setErrorLocale

      public void setErrorLocale(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 if next() would return an element rather than throwing an exception.
      Specified by:
      hasNext in interface Iterator<String[]>
      Returns:
      True if the CSVIterator has more elements.
    • next

      public String[] next()
      Returns the next element in the iterator.
      Specified by:
      next in interface Iterator<String[]>
      Returns:
      The next element of the iterator.
    • remove

      public void remove()
      This method is not supported by opencsv and will throw an UnsupportedOperationException if called.
      Specified by:
      remove in interface Iterator<String[]>