|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavatools.datatypes.PeekIterator<java.util.List<java.lang.String>>
javatools.filehandlers.CSVLines
public class CSVLines
This class is part of the Java Tools (see http://mpii.de/yago-naga/javatools).
It is licensed under the Creative Commons Attribution License
(see http://creativecommons.org/licenses/by/3.0) by
the YAGO-NAGA team (see http://mpii.de/yago-naga).
The class provides an iterator over the lines in a comma-separated file
Example:
for(ListRecognizes column headers if introduced by '#'. Recognizes all types of encodings (see Char.decode()).columns : new CSVFile("c:\\autoexec.csv")) { System.out.println(columns); }
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javatools.datatypes.PeekIterator |
---|
PeekIterator.ElementaryPeekIterator<T>, PeekIterator.SimplePeekIterator<T> |
Field Summary |
---|
Fields inherited from class javatools.datatypes.PeekIterator |
---|
closed, initialized, next |
Constructor Summary | |
---|---|
CSVLines(java.io.File f)
Constructs a CSVReader |
|
CSVLines(java.io.Reader reader)
Constructs a CSVReader |
|
CSVLines(java.lang.String file)
Constructs a CSVReader |
Method Summary | |
---|---|
void |
close()
Closes the underlying resource |
java.util.List<java.lang.String> |
columnNames()
returns the column names (or NULL) |
static void |
main(java.lang.String[] args)
Test method |
java.lang.Integer |
numColumns()
returns the number of columns (or NULL) |
void |
setSeparator(char s)
Sets the separator (comma by default) |
Methods inherited from class javatools.datatypes.PeekIterator |
---|
asList, asList, asSet, asSet, asSet, emptyIterator, hasNext, iterator, list, list, next, nextOrNull, numElements, numElements, peek, remove, toString, toString, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CSVLines(java.io.File f) throws java.io.IOException
java.io.IOException
public CSVLines(java.io.Reader reader) throws java.io.IOException
java.io.IOException
public CSVLines(java.lang.String file) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public void setSeparator(char s)
public java.util.List<java.lang.String> columnNames()
public java.lang.Integer numColumns()
public void close()
PeekIterator
close
in interface java.io.Closeable
close
in class PeekIterator<java.util.List<java.lang.String>>
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |