net.java.sen.util
Class CSVParser

java.lang.Object
  extended by net.java.sen.util.CSVParser

public class CSVParser
extends Object

parse CSV file and extract token.


Constructor Summary
CSVParser(InputStream inputStream, String charset)
          Constructor for a parser that reads lines from an InputStream
CSVParser(String string)
          Constructor for a parser that reads lines from a String
 
Method Summary
 String currentLine()
          Returns the unparsed current line of text
 boolean nextRow()
          Advances to the next line of CSV data, if any, skipping any remaining values on the current row
 String nextToken()
          Reads the next value from the current line
 String[] nextTokens()
          Returns an array of all values from the next line of the input
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSVParser

public CSVParser(InputStream inputStream,
                 String charset)
          throws IOException
Constructor for a parser that reads lines from an InputStream

Parameters:
inputStream - The InputStream to read from
charset - The charset of the InputStream
Throws:
IOException

CSVParser

public CSVParser(String string)
Constructor for a parser that reads lines from a String

Parameters:
string - The string to read from
Method Detail

nextRow

public boolean nextRow()
                throws IOException
Advances to the next line of CSV data, if any, skipping any remaining values on the current row

Returns:
true if a line was read; false othewise
Throws:
IOException

nextToken

public String nextToken()
Reads the next value from the current line

Returns:
token The value

nextTokens

public String[] nextTokens()
                    throws IOException
Returns an array of all values from the next line of the input

Returns:
tokens The values
Throws:
IOException

currentLine

public String currentLine()
Returns the unparsed current line of text

Returns:
The line of text


Copyright © 2012. All Rights Reserved.