Class CVSParser
- java.lang.Object
-
- fr.ens.biologie.genomique.aozan.util.CVSParser
-
- All Implemented Interfaces:
Iterable<CSVLineParser>
public class CVSParser extends Object implements Iterable<CSVLineParser>
This class allow to parse CSV files- Since:
- 3.0
- Author:
- Laurent Jourdren
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(String fieldName)
Test if the file contains a fieldList<String>
fields()
Get the list of the fields.Iterator<CSVLineParser>
iterator()
CSVLineParser
parse(String line)
Parse a line.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
CVSParser
public CVSParser(Path file) throws IOException
Constructor.- Parameters:
file
- file to read- Throws:
IOException
- if an error occurs while reading file
-
CVSParser
public CVSParser(Path file, char separator) throws IOException
Constructor.- Parameters:
file
- file to readseparator
- separator char- Throws:
IOException
- if an error occurs while reading file
-
-
Method Detail
-
contains
public boolean contains(String fieldName)
Test if the file contains a field- Parameters:
fieldName
- field name- Returns:
- true if the field exists in the file
-
fields
public List<String> fields()
Get the list of the fields.- Returns:
- a list with the fields of the file
-
parse
public CSVLineParser parse(String line)
Parse a line.- Parameters:
line
- line to parse- Returns:
- a CSVLineParser object
-
iterator
public Iterator<CSVLineParser> iterator()
- Specified by:
iterator
in interfaceIterable<CSVLineParser>
-
-