planetj.helpers
Class CSVHelper

java.lang.Object
  |
  +--planetj.helpers.FileHelper
        |
        +--planetj.helpers.CSVHelper

public class CSVHelper
extends FileHelper

This class will assist in creating CSV files. Although it's called CSVHelper (Comma Separated Variable), the delimiter may be any 'char' value.

See Also:

Creation date: (12/4/2001 9:32:24 PM)


Method Summary
 StringBuffer generateCSVFile(ICSVRow pCSVRow, CSVFileDescriptor pCSVFileDescriptor)
          This method will generate a CSV file with CSV data supplied in pCSVRow.getCSVRow().
 StringBuffer generateCSVFile(List pList, CSVFileDescriptor pCSVFileDescriptor)
          This method will generate a CSV file with CSV data supplied in pList.get(i).toString() if pList.elementAt(i) is not a ICSVField, ICSVRow or List.
 StringBuffer getCSVData(ICSVRow pCSVRow, CSVFileDescriptor pCSVFileDescriptor)
          Converts an ICSVRow into a String containing CSV data.
 StringBuffer getCSVData(List pList, CSVFileDescriptor pCSVFileDescriptor)
          Converts an List of items into a String containing CSV data.
static CSVFileDescriptor newCSVFileDescriptor()
          This is the only way to get an instance of a new CSVFileDescriptor Creation date: (12/5/2001 3:15:14 PM)
static CSVFileDescriptor newCSVFileDescriptor(FilePropertyGroup pProperties)
          This is the only way to get an instance of a new CSVFileDescriptor Creation date: (12/5/2001 3:15:14 PM)
static CSVHelper singleton()
          CSVHelper implements the singleton model so this method is the only way to get an instance of this class Creation date: (12/4/2001 10:58:17 PM)
 
Methods inherited from class planetj.helpers.FileHelper
getAS400, getFileSeparator, newFileDescriptor, newFileDescriptor, validateFileName, writeData
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

generateCSVFile

public StringBuffer generateCSVFile(List pList,
                                    CSVFileDescriptor pCSVFileDescriptor)
                             throws CMException
This method will generate a CSV file with CSV data supplied in pList.get(i).toString() if pList.elementAt(i) is not a ICSVField, ICSVRow or List. If pList.elementAt(i) is a ICSVField, the getCSVField() will be called and that returned String will be the data written to the CSV file.

The file will be generated from attributes of pCSVFileDescriptor

Creation date: (12/4/2001 10:07:48 PM)

CMException

generateCSVFile

public StringBuffer generateCSVFile(ICSVRow pCSVRow,
                                    CSVFileDescriptor pCSVFileDescriptor)
                             throws CMException
This method will generate a CSV file with CSV data supplied in pCSVRow.getCSVRow(). The file will be generated from attributes of pCSVFileDescriptor Creation date: (12/4/2001 10:07:48 PM)

CMException

getCSVData

public StringBuffer getCSVData(List pList,
                               CSVFileDescriptor pCSVFileDescriptor)
                        throws CMException
Converts an List of items into a String containing CSV data. If the CSVDescriptor has a writer set, then the CSV data is written to that writer and this method returns null. If the CSVDescriptor does not have a writer set, then the CSV data is returned in a StringBuffer

Creation date: (2/13/2002 1:36:21 PM)

CMException

getCSVData

public StringBuffer getCSVData(ICSVRow pCSVRow,
                               CSVFileDescriptor pCSVFileDescriptor)
                        throws CMException
Converts an ICSVRow into a String containing CSV data. If the CSVDescriptor has a writer set, then the CSV data is written to that writer and this method returns null. If the CSVDescriptor does not have a writer set, then the CSV data is returned in a StringBuffer

Creation date: (2/13/2002 1:36:21 PM)

CMException

newCSVFileDescriptor

public static CSVFileDescriptor newCSVFileDescriptor()
This is the only way to get an instance of a new CSVFileDescriptor Creation date: (12/5/2001 3:15:14 PM)

Returns:
new CSVFileDescriptor()

newCSVFileDescriptor

public static CSVFileDescriptor newCSVFileDescriptor(FilePropertyGroup pProperties)
This is the only way to get an instance of a new CSVFileDescriptor Creation date: (12/5/2001 3:15:14 PM)

Returns:
new CSVFileDescriptor()

singleton

public static CSVHelper singleton()
CSVHelper implements the singleton model so this method is the only way to get an instance of this class Creation date: (12/4/2001 10:58:17 PM)

Returns:
planetj.helpers.CSVHelper mSingleton, an instance of this Class