com.jaxfront.core.util.io.cvsexport
Interface CSVReader

All Known Implementing Classes:
SimpleCVSReader

public interface CSVReader

Interface provided for things that like to play with interfaces, see

See Also:
SimpleCVSReader

Field Summary
static char BACKSLASH
           
static char COMMA
           
static char DOUBLE_QUOTE
           
static char SINGLE_QUOTE
           
static char TAB
           
 
Method Summary
 java.util.List parse(java.io.File in)
          Opens, parses, and closes a file
 void parse(java.io.File in, CVSReaderCallback callback)
          Opens, parses, and closes a file
 java.util.List parse(java.io.InputStream in)
          Returns a List of String[]
 void parse(java.io.InputStream in, CVSReaderCallback callback)
          Invoke the callback for each row of the CSV, passing in the fields.
 java.util.List parse(java.io.Reader in)
          Returns a List of String[]
 void parse(java.io.Reader in, CVSReaderCallback callback)
          Invoke the callback for each row of the CSV, passing in the fields.
 java.util.List parse(java.lang.String raw)
          Returns a List of String[] where it is passed the raw (including line breaks) content of the csv
 void parse(java.lang.String raw, CVSReaderCallback callback)
          Calls onRow for each row in the raw (including line breaks) content of the csv, passed as a String
 void setEscapeCharacter(char escape)
          Specify an escape character within a field, default is \
 void setLineCommentIndicator(java.lang.String token)
          Specify a string that is used to indicate that a line should be passed over without processing.
 void setQuoteCharacters(char[] quotes)
          Specify an array of chars that will be treated as quotes, ie, will be ignored and everything between them is one field.
 void setSeperator(char seperator)
          Specify the field seperator character, defaults to a comma
 void setTrim(boolean b)
          Trim whitespace around fields, defaults to false
 

Field Detail

COMMA

static final char COMMA
See Also:
Constant Field Values

TAB

static final char TAB
See Also:
Constant Field Values

SINGLE_QUOTE

static final char SINGLE_QUOTE
See Also:
Constant Field Values

DOUBLE_QUOTE

static final char DOUBLE_QUOTE
See Also:
Constant Field Values

BACKSLASH

static final char BACKSLASH
See Also:
Constant Field Values
Method Detail

parse

void parse(java.lang.String raw,
           CVSReaderCallback callback)
Calls onRow for each row in the raw (including line breaks) content of the csv, passed as a String


parse

java.util.List parse(java.lang.String raw)
Returns a List of String[] where it is passed the raw (including line breaks) content of the csv


parse

java.util.List parse(java.io.File in)
                     throws java.io.IOException
Opens, parses, and closes a file

Throws:
java.io.IOException - if there is an error reading
java.io.FileNotFoundException - if the file does not exist

parse

void parse(java.io.File in,
           CVSReaderCallback callback)
           throws java.io.IOException
Opens, parses, and closes a file

Throws:
java.io.IOException - if there is an error reading
java.io.FileNotFoundException - if the file does not exist

parse

java.util.List parse(java.io.Reader in)
                     throws java.io.IOException
Returns a List of String[]

Parameters:
in - will not be closed by the reader
Throws:
java.io.IOException

parse

java.util.List parse(java.io.InputStream in)
                     throws java.io.IOException
Returns a List of String[]

Parameters:
in - will not be closed by the reader
Throws:
java.io.IOException

parse

void parse(java.io.InputStream in,
           CVSReaderCallback callback)
           throws java.io.IOException
Invoke the callback for each row of the CSV, passing in the fields.

Parameters:
in - will not be closed by the reader
Throws:
java.io.IOException

parse

void parse(java.io.Reader in,
           CVSReaderCallback callback)
           throws java.io.IOException
Invoke the callback for each row of the CSV, passing in the fields.

Parameters:
in - will not be closed by the reader
Throws:
java.io.IOException

setEscapeCharacter

void setEscapeCharacter(char escape)
Specify an escape character within a field, default is \


setSeperator

void setSeperator(char seperator)
Specify the field seperator character, defaults to a comma


setQuoteCharacters

void setQuoteCharacters(char[] quotes)
Specify an array of chars that will be treated as quotes, ie, will be ignored and everything between them is one field. Default is ' and "


setTrim

void setTrim(boolean b)
Trim whitespace around fields, defaults to false

Parameters:
b -

setLineCommentIndicator

void setLineCommentIndicator(java.lang.String token)
Specify a string that is used to indicate that a line should be passed over without processing. When the passed String is the very first thing on the line, the whole line will be skipped.

Passing null indicates all lines should be processed

Processing all lines is the default behavior