net.datacrow.util
Class CSVReader

java.lang.Object
  extended by net.datacrow.util.CSVReader

public class CSVReader
extends java.lang.Object

A very simple CSV reader released under a commercial-friendly license.

Author:
Glen Smith

Field Summary
static char DEFAULT_QUOTE_CHARACTER
           
static int DEFAULT_SKIP_LINES
           
 
Constructor Summary
CSVReader(java.io.Reader reader, java.lang.String separator)
           
 
Method Summary
 void close()
          Closes the underlying reader.
 java.util.List<java.lang.String[]> readAll()
          Reads the entire file into a List with each element being a String[] of tokens.
 java.lang.String[] readNext()
          Reads the next line from the buffer and converts to a string array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_QUOTE_CHARACTER

public static final char DEFAULT_QUOTE_CHARACTER
See Also:
Constant Field Values

DEFAULT_SKIP_LINES

public static final int DEFAULT_SKIP_LINES
See Also:
Constant Field Values
Constructor Detail

CSVReader

public CSVReader(java.io.Reader reader,
                 java.lang.String separator)
Method Detail

readAll

public java.util.List<java.lang.String[]> readAll()
                                           throws java.io.IOException
Reads the entire file into a List with each element being a String[] of tokens.

Returns:
a List of String[], with each String[] representing a line of the file.
Throws:
java.io.IOException

readNext

public java.lang.String[] readNext()
                            throws java.io.IOException
Reads the next line from the buffer and converts to a string array.

Returns:
a string array with each comma-separated element as a separate entry.
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Closes the underlying reader.

Throws:
java.io.IOException