biz.chitec.quarterback.util
Class CSVWriter
java.lang.Object
biz.chitec.quarterback.util.CSVHandler
biz.chitec.quarterback.util.CSVWriter
- public class CSVWriter
- extends CSVHandler
Creates a CSV output from Maps each representing one row of the table. Before starting table creation, columns must
be defined using putInValueType(). Additionally, column and decimal separator character can be set. They default to
";" and ".". Theses changes are not possible any more if output has started and the header has been written.
- Version:
- $Id: b1f117b96307a8167943ecda8ad9bd5be60799c3 $
- Author:
- Dirk Hillbrecht 1997-2000, chitec/Dirk Hillbrecht 2000-2003, cantamen/Dirk Hillbrecht 2003-2006.
Distributed under the terms of the GNU LGPL .
- See Also:
CSVHandler
,
CSVReader
Fields inherited from class biz.chitec.quarterback.util.CSVHandler |
BOOL, coding, columnseparator, DATE, decimalseparator, FLOAT, iBOOL, iDATE, iFLOAT, iINT, iMEMSTRINT, INT, iSTRING, iSTRINT, MEMSTRINT, saveescaping, STRING, STRINT |
Methods inherited from class biz.chitec.quarterback.util.CSVHandler |
getColumnSeparator, getDecimalSeparator, isSaveEscaping, removeKeyValue, setCoding, setColumnSeparator, setDecimalSeparator, setKeyValues, setKeyValues, setKeyValues, setSaveEscaping |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
valuetype
private java.util.List valuetype
bw
private java.io.PrintWriter bw
wroteheader
private boolean wroteheader
additionalconverter
private java.util.Map additionalconverter
CSVWriter
public CSVWriter()
CSVWriter
public CSVWriter(java.lang.Integer type,
CSVWriter.Converter c)
addConverter
public void addConverter(java.lang.Integer type,
CSVWriter.Converter c)
putInValueType
protected void putInValueType(java.lang.String key,
java.util.Map h)
- Specified by:
putInValueType
in class CSVHandler
removeValueType
protected void removeValueType(java.lang.String key)
- Specified by:
removeValueType
in class CSVHandler
removeKeyValues
public void removeKeyValues()
- Description copied from class:
CSVHandler
- removes all key definitions (e.g. to reuse the CSVReader for a new table)
- Specified by:
removeKeyValues
in class CSVHandler
setOutputStream
public void setOutputStream(java.io.OutputStream os)
throws java.io.IOException
- Throws:
java.io.IOException
writeHeader
private void writeHeader()
escapeCharacters
private java.lang.String escapeCharacters(java.lang.String s)
- Escapes some special characters in Strings
elementToString
protected java.lang.String elementToString(int column,
java.lang.Object o)
putNextLine
public void putNextLine(java.util.Map h)
printLine
private void printLine(java.lang.StringBuffer line)
flush
public void flush()
close
public void close()