org.deegree.commons.dataaccess
Class CSVReader

java.lang.Object
  extended by java.io.Reader
      extended by java.io.BufferedReader
          extended by java.io.LineNumberReader
              extended by org.deegree.commons.dataaccess.CSVReader
All Implemented Interfaces:
Closeable, Readable

public class CSVReader
extends LineNumberReader

The CSVReader reads a csv file line by line. Note the regular expression for quotes may not work under all circumstances, a Tokenizer might be a better solution.

Version:
$Revision: 28683 $, $Date: 2010-12-10 11:37:25 +0100 (Fri, 10 Dec 2010) $
Author:
Rutger Bezema, last edited by: $Author: aschmitz $

Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
CSVReader(Reader in, String delimiter, boolean firstLineContainsColumnNames)
           
 
Method Summary
 String[] getColumnsNames()
           
 String getDelimiter()
           
 int getNumberOfColumns()
           
 String[] parseLine()
           
 
Methods inherited from class java.io.LineNumberReader
getLineNumber, mark, read, read, readLine, reset, setLineNumber, skip
 
Methods inherited from class java.io.BufferedReader
close, markSupported, ready
 
Methods inherited from class java.io.Reader
read, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSVReader

public CSVReader(Reader in,
                 String delimiter,
                 boolean firstLineContainsColumnNames)
Parameters:
in -
delimiter -
firstLineContainsColumnNames -
Method Detail

parseLine

public String[] parseLine()
                   throws IOException
Returns:
the values of the
Throws:
IOException

getColumnsNames

public final String[] getColumnsNames()
Returns:
the values of the first row, which may be the column names or the first line of data.

getNumberOfColumns

public final int getNumberOfColumns()
Returns:
the numberOfColumns

getDelimiter

public final String getDelimiter()
Returns:
the delimiter


Copyright © 2011. All Rights Reserved.