Documentation of 'org.hsqldb.util.CSVWriter' Java class
CSVWriter
org.hsqldb.util

Class CSVWriter



  • public class CSVWriter
    extends java.lang.Object
    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.
    • Constructor Summary

      Constructors 
      Constructor and Description
      CSVWriter(java.io.File file, java.lang.String encoding)
      constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void close()
      closes the csv file.
      void writeData(java.lang.String[] data)
      writes a data-record to the file.
      void writeHeader(java.lang.String[] header)
      writes the csv header (fieldnames).
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CSVWriter

        public CSVWriter(java.io.File file,
                         java.lang.String encoding)
                  throws java.io.IOException
        constructor. creates a csv file for writing data to it
        Parameters:
        file - the file to write data to
        encoding - encoding to use or null (=defualt)
        Throws:
        java.io.IOException
    • Method Detail

      • writeHeader

        public void writeHeader(java.lang.String[] header)
                         throws java.io.IOException
        writes the csv header (fieldnames). should be called after construction one time.
        Parameters:
        header - String[] with fieldnames
        Throws:
        java.io.IOException
      • writeData

        public void writeData(java.lang.String[] data)
                       throws java.io.IOException
        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
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        closes the csv file.
        Throws:
        java.io.IOException

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.