org.tbee.csv
Class CSVFileWriter

java.lang.Object
  extended by org.tbee.csv.CSVFileWriter

public class CSVFileWriter
extends Object

This class provides file level access to write CSV files. It requires an output stream.
The default line separator is per default a newline (\n) but can be set prior to parsing. The field separator can be set in the StringParser using getStringParser(). The parser recognizes comment lines if the first character in a line is a comment marker, default (#). The first line may contain header information. In this case the identifiers are used in the map. The file parsers counts the lines it has parsed according to the line separator.

Version:
$Revision: 1.2 $
Author:
$Author: cvs $

Field Summary
static String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Constructor Summary
CSVFileWriter()
          Just the basic constructor Note that a OutputStream must be set before the parse method is called
CSVFileWriter(OutputStream pOutputStream)
          Usually there is a stream that is parsed This need not be a file OutputStream
 
Method Summary
 void addComment(String pComment)
          Add comments to the output
 void appendField(String pValue)
          Add a field to the current line
 void commitLine()
          Add the line to the output
 char getComment()
           
 char getEscaper()
           
 char getFieldSeparator()
           
 long getLineNumber()
           
 String getLineSeparator()
           
 OutputStream getOutputStream()
           
 void setComment(char pComment)
           
 void setEscaper(char pEscaper)
           
 void setFieldSeparator(char pSeparator)
           
 void setLineSeparator(String pSeparator)
           
 void setOutputStream(OutputStream pOutputStream)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOURCECODE_VERSION

public static final String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values
Constructor Detail

CSVFileWriter

public CSVFileWriter()
Just the basic constructor Note that a OutputStream must be set before the parse method is called


CSVFileWriter

public CSVFileWriter(OutputStream pOutputStream)
Usually there is a stream that is parsed This need not be a file OutputStream

Method Detail

setLineSeparator

public void setLineSeparator(String pSeparator)

getLineSeparator

public String getLineSeparator()

setComment

public void setComment(char pComment)

getComment

public char getComment()

setFieldSeparator

public void setFieldSeparator(char pSeparator)

getFieldSeparator

public char getFieldSeparator()

setEscaper

public void setEscaper(char pEscaper)

getEscaper

public char getEscaper()

setOutputStream

public void setOutputStream(OutputStream pOutputStream)

getOutputStream

public OutputStream getOutputStream()

getLineNumber

public long getLineNumber()

appendField

public void appendField(String pValue)
                 throws IOException
Add a field to the current line

Throws:
IOException

commitLine

public void commitLine()
                throws IOException
Add the line to the output

Throws:
IOException

addComment

public void addComment(String pComment)
                throws IOException
Add comments to the output

Throws:
IOException


Copyright © 2011 KnowledgePlaza. All Rights Reserved.