| java.lang.Object org.hsqldb.util.CSVWriter
CSVWriter | public class CSVWriter (Code) | | helper class to write table data to a csv-file (comma separated values).
the first line in file is a list of fieldnames, all following lines
are data lines.
a descptiontion of file format can be found on: http://www.wotsit.org/
usage: create a object using the constructor. call writeHeader
for writing the filename header then add data with writeData.
at the end close() closes the file.
author: jeberle@users |
Method Summary | |
public void | close() closes the csv file. | public void | writeData(String[] data) writes a data-record to the file. | public void | writeHeader(String[] header) writes the csv header (fieldnames). |
CSVWriter | public CSVWriter(File file, String encoding) throws IOException(Code) | | constructor.
creates a csv file for writing data to it
Parameters: file - the file to write data to Parameters: encoding - encoding to use or null (=defualt) |
writeData | public void writeData(String[] data) throws IOException(Code) | | writes a data-record to the file. note that data[] must have
same number of elements as the header had.
Parameters: data - data to write to csv-file |
writeHeader | public void writeHeader(String[] header) throws IOException(Code) | | writes the csv header (fieldnames). should be called after
construction one time.
Parameters: header - String[] with fieldnames |
|
|