com.partnersoft.formats.csv
Class CsvLib

java.lang.Object
  extended by com.partnersoft.formats.csv.CsvLib

public class CsvLib
extends java.lang.Object

Handy CSV tools.

Author:
Paul Reavis Copyright 2004 Partner Software, Inc.

Method Summary
static void appendRecord(java.io.File file, Naming values)
          Appends a record to the end of an existing CSV file.
static void appendRecord(java.lang.String filePath, Naming values)
           
static int csvTypeCode(java.lang.String typeName)
           
static java.lang.String encodeCSV(java.util.ArrayList values)
           
static void encodeValue(java.lang.Object value, DynamicCharArray buffer, java.io.Writer output)
           
static void parseCSV(char[] chars, int start, int end, java.util.ArrayList results)
           
static void parseCSV(int type, char[] chars, int start, int end, java.util.ArrayList results)
           
static void parseCSV(int type, char[] chars, int start, int end, DynamicStringArray results)
           
static void parseCSV(int type, java.lang.String line, java.util.ArrayList results)
           
static void parseCSV(int type, java.lang.String line, DynamicStringArray results)
           
static java.util.ArrayList parseCSV(java.lang.String line)
           
static void parseCSV(java.lang.String line, java.util.ArrayList results)
           
static void parseCSV(java.lang.String type, char[] chars, int start, int end, java.util.ArrayList results)
           
static void parseCSV(java.lang.String type, java.lang.String line, java.util.ArrayList results)
           
static java.util.List<java.lang.String> readFieldNamesFrom(VfsFile csvFile)
          Reads the first line of the given CSV file as field names and returns the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encodeCSV

public static java.lang.String encodeCSV(java.util.ArrayList values)

encodeValue

public static void encodeValue(java.lang.Object value,
                               DynamicCharArray buffer,
                               java.io.Writer output)
                        throws java.io.IOException
Throws:
java.io.IOException

csvTypeCode

public static int csvTypeCode(java.lang.String typeName)

parseCSV

public static java.util.ArrayList parseCSV(java.lang.String line)

parseCSV

public static void parseCSV(java.lang.String line,
                            java.util.ArrayList results)

parseCSV

public static void parseCSV(char[] chars,
                            int start,
                            int end,
                            java.util.ArrayList results)

parseCSV

public static void parseCSV(java.lang.String type,
                            java.lang.String line,
                            java.util.ArrayList results)

parseCSV

public static void parseCSV(java.lang.String type,
                            char[] chars,
                            int start,
                            int end,
                            java.util.ArrayList results)

parseCSV

public static void parseCSV(int type,
                            java.lang.String line,
                            java.util.ArrayList results)

parseCSV

public static void parseCSV(int type,
                            char[] chars,
                            int start,
                            int end,
                            java.util.ArrayList results)

parseCSV

public static void parseCSV(int type,
                            java.lang.String line,
                            DynamicStringArray results)

parseCSV

public static void parseCSV(int type,
                            char[] chars,
                            int start,
                            int end,
                            DynamicStringArray results)

appendRecord

public static void appendRecord(java.lang.String filePath,
                                Naming values)
                         throws java.io.IOException
Throws:
java.io.IOException

appendRecord

public static void appendRecord(java.io.File file,
                                Naming values)
                         throws java.io.IOException
Appends a record to the end of an existing CSV file. The CSV file must have field names in the first line; this function reads the first line, then re-opens the file in append mode and tacks a comma-separated line on the end.

Throws:
java.io.IOException

readFieldNamesFrom

public static java.util.List<java.lang.String> readFieldNamesFrom(VfsFile csvFile)
                                                           throws java.io.IOException
Reads the first line of the given CSV file as field names and returns the result.

Throws:
java.io.IOException