com.bm.utils.csv
Interface CSVParse

All Known Implementing Classes:
CSVParser

public interface CSVParse

Read files in comma separated value format.

Since:
17.04.2006
Author:
Daniel Wiese

Method Summary
 void changeDelimiter(char newDelim)
          Change this parser so that it uses a new delimiter.
 void changeQuote(char newQuote)
          Change this parser so that it uses a new character for quoting.
 void close()
          Close any stream upon which this parser is based.
 int getLastLineNumber()
          Get the line number that the last token came from.
 int lastLineNumber()
          Get the line number that the last token came from.
 java.lang.String nextValue()
          Read the next value from the file.
 

Method Detail

nextValue

java.lang.String nextValue()
                           throws java.io.IOException
Read the next value from the file. The line number from which this value was taken can be obtained from getLastLineNumber().

Returns:
the next value or null if there are no more values.
Throws:
java.io.IOException - if an error occurs while reading.

lastLineNumber

int lastLineNumber()
Get the line number that the last token came from.

Returns:
line number or -1 if no tokens have been returned yet.

getLastLineNumber

int getLastLineNumber()
Get the line number that the last token came from.

New line breaks that occur in the middle of a token are not counted in the line number count.

Returns:
line number or -1 if no tokens have been returned yet.

changeDelimiter

void changeDelimiter(char newDelim)
Change this parser so that it uses a new delimiter.

The initial character is a comma, the delimiter cannot be changed to a quote or other character that has special meaning in CSV.

Parameters:
newDelim - delimiter to which to switch.
Throws:
BadDelimiterException - if the character cannot be used as a delimiter.

changeQuote

void changeQuote(char newQuote)
Change this parser so that it uses a new character for quoting.

The initial character is a double quote ("), the delimiter cannot be changed to a comma or other character that has special meaning in CSV.

Parameters:
newQuote - character to use for quoting.
Throws:
BadQuoteException - if the character cannot be used as a quote.

close

void close()
           throws java.io.IOException
Close any stream upon which this parser is based.

Throws:
java.io.IOException - if an error occurs while closing the stream.
Since:
ostermillerutils 1.02.26


Copyright © 2008. All Rights Reserved.