public class CSVLineIterator extends Object implements DataIterator<String[]>
| Modifier and Type | Field and Description |
|---|---|
static char |
DEFAULT_SEPARATOR
The default separator to use
|
| Constructor and Description |
|---|
CSVLineIterator(Reader reader,
char separator)
Creates a parser that reads from a reader and used a special separator character
|
CSVLineIterator(Reader reader,
char separator,
boolean ignoreEmptyLines) |
CSVLineIterator(String uri)
Creates a parser that reads from a uri
|
CSVLineIterator(String uri,
char separator)
Creates a parser that reads from a uri
|
CSVLineIterator(String uri,
char separator,
boolean ignoreEmptyLines) |
CSVLineIterator(String uri,
char separator,
boolean ignoreEmptyLines,
String encoding) |
CSVLineIterator(String uri,
char separator,
String encoding) |
| Modifier and Type | Method and Description |
|---|---|
String |
cellByHeader(String header,
String[] data) |
String[] |
cellsByHeaders(String[] headers,
String[] data) |
void |
close()
Closes the source
|
int |
columnIndexOfHeader(String header) |
Class<String[]> |
getType()
Returns the type of the iterated elements.
|
int |
lineCount() |
DataContainer<String[]> |
next(DataContainer<String[]> wrapper)
Parses a CSV row into an array of Strings
|
static void |
process(String uri,
char separator,
String encoding,
boolean ignoreEmptyLines,
CSVLineHandler lineHandler) |
void |
setHeaders(String[] headers) |
String |
toString() |
public static final char DEFAULT_SEPARATOR
public CSVLineIterator(String uri) throws IOException
uri - the URL to read fromIOException - if uri access failedpublic CSVLineIterator(String uri, char separator) throws IOException
uri - the URL to read fromseparator - the cell separator characterIOException - if stream access failspublic CSVLineIterator(String uri, char separator, String encoding) throws IOException
IOExceptionpublic CSVLineIterator(String uri, char separator, boolean ignoreEmptyLines) throws IOException
IOExceptionpublic CSVLineIterator(String uri, char separator, boolean ignoreEmptyLines, String encoding) throws IOException
IOExceptionpublic CSVLineIterator(Reader reader, char separator) throws IOException
reader - the reader to useseparator - the separator characterIOException - if reader access failspublic CSVLineIterator(Reader reader, char separator, boolean ignoreEmptyLines) throws IOException
IOExceptionpublic void setHeaders(String[] headers)
public Class<String[]> getType()
DataIteratorgetType in interface DataIterator<String[]>public DataContainer<String[]> next(DataContainer<String[]> wrapper)
next in interface DataIterator<String[]>wrapper - a DataContainer to receive the iterated datapublic int columnIndexOfHeader(String header)
public void close()
close in interface Closeableclose in interface AutoCloseableclose in interface DataIterator<String[]>public int lineCount()
public static void process(String uri, char separator, String encoding, boolean ignoreEmptyLines, CSVLineHandler lineHandler) throws IOException
IOExceptionCopyright © 2006–2016 Volker Bergmann. All rights reserved.