org.onebusaway.csv_entities
Class CSVLibrary

java.lang.Object
  extended by org.onebusaway.csv_entities.CSVLibrary

public class CSVLibrary
extends Object

Why do we have our own CSV reader when there are a couple of existing Java libraries? Mostly because we need to be able to handle some malformed CSV that most parsers would choke on but that agencies produce and google seems to validate as well.

Author:
bdferris

Constructor Summary
CSVLibrary()
           
 
Method Summary
static String escapeValue(String value)
           
static String getArrayAsCSV(double[] args)
           
static
<T> String
getArrayAsCSV(T[] args)
           
static String getAsCSV(Object... args)
           
static
<T> String
getIterableAsCSV(Iterable<T> args)
           
 void parse(BufferedReader r, CSVListener handler)
           
 void parse(File input, CSVListener handler)
           
 void parse(InputStream is, CSVListener handler)
           
 List<String> parse(String line)
           
 void setTrimInitialWhitespace(boolean trimInitialWhitespace)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSVLibrary

public CSVLibrary()
Method Detail

escapeValue

public static String escapeValue(String value)

getArrayAsCSV

public static String getArrayAsCSV(double[] args)

getArrayAsCSV

public static <T> String getArrayAsCSV(T[] args)

getIterableAsCSV

public static <T> String getIterableAsCSV(Iterable<T> args)

getAsCSV

public static String getAsCSV(Object... args)

setTrimInitialWhitespace

public void setTrimInitialWhitespace(boolean trimInitialWhitespace)

parse

public final void parse(InputStream is,
                        CSVListener handler)
                 throws Exception
Throws:
Exception

parse

public final void parse(File input,
                        CSVListener handler)
                 throws Exception
Throws:
Exception

parse

public void parse(BufferedReader r,
                  CSVListener handler)
           throws IOException,
                  Exception
Throws:
IOException
Exception

parse

public final List<String> parse(String line)


Copyright © 2012 OneBusAway. All Rights Reserved.