net.server.servlets
Class CsvLineParser

java.lang.Object
  extended by net.server.servlets.CsvLineParser

public class CsvLineParser
extends java.lang.Object

The CsvLineParser class is a utility class which enables extraction of values from a comma separated value, or CSV, file.

Version:
1.00
Author:
Robert Lysik

Constructor Summary
CsvLineParser()
          This is the default constructor for the CsvLineParser class.
 
Method Summary
 int getTokenCount(java.lang.StringBuffer sb)
          This function calculates the number of values in the comma separated value string which is passed in as a parameter in the form of a StringBuffer object.
 java.lang.String[] getTokens(java.lang.String csvString)
          This function takes the unparsed comma separated value string as an argument.
 java.lang.String[] getValues(java.lang.String s, int[] plays)
          This method takes the unparsed comma separated value string and an array of integers representing the indices of the strings to extract from the CSV string as arguments.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CsvLineParser

public CsvLineParser()
This is the default constructor for the CsvLineParser class.

Method Detail

getValues

public java.lang.String[] getValues(java.lang.String s,
                                    int[] plays)
This method takes the unparsed comma separated value string and an array of integers representing the indices of the strings to extract from the CSV string as arguments. The return value of this function is an array of the requested strings.


getTokens

public java.lang.String[] getTokens(java.lang.String csvString)
This function takes the unparsed comma separated value string as an argument. Each character in the string is examined to determine whether or not it is a comma. If so, a substring is extracted from the CSV string up to the comma and the starting index of the string is incremented one position beyond the location of the comma.


getTokenCount

public int getTokenCount(java.lang.StringBuffer sb)
This function calculates the number of values in the comma separated value string which is passed in as a parameter in the form of a StringBuffer object. Each character in the StringBuffer object is examined to determine whether or not it is a comma. If a comma is found, the count of tokens is incremented by one.