DexNet 4.7.0
Public Member Functions
com::sparsity::dex::io::CSVWriter Class Reference

CSVWriter interface. More...

Inheritance diagram for com::sparsity::dex::io::CSVWriter:
Inheritance graph
Collaboration diagram for com::sparsity::dex::io::CSVWriter:
Collaboration graph

List of all members.

Public Member Functions

void SetSeparator (System.String sep) throws System.ApplicationException
 Sets the character used to separate fields in the file.
void SetQuotes (System.String quotes) throws System.ApplicationException
 Sets the character used to quote fields.
void SetLocale (System.String localeStr)
 Sets the locale that will be used to write the file.
void SetForcedQuotes (com.sparsity.dex.gdb.BooleanList forcequotes)
 Disables the automatic quote mode and forces to be quoted those positions set to TRUE in the given vector.
void SetAutoQuotes (bool autoquotes)
 Sets on/off the automatic quote mode.
void Close () throws System.IO.IOException, System.ApplicationException
 Closes the writer.
void Write (com.sparsity.dex.gdb.StringList row) throws System.IO.IOException, System.ApplicationException
 Writes the next row.
 CSVWriter ()
 Creates a new instance.
void Open (System.String f) throws System.IO.IOException
 Opens the output file path.

Detailed Description

CSVWriter interface.

A very simple CSV writer implementing RowWriter.

It works as any other RowWriter, but open must be called once before the first write operation.

It uses the format RFC 4180: http://tools.ietf.org/html/rfc4180

You can use your own separators and quote characters. By default the separator is the comma (,) and the quote character is the double quotes (") and autoquote is enabled.

See the CSVReader locale documentation.

Author:
Sparsity Technologies http://www.sparsity-technologies.com

Member Function Documentation

void com::sparsity::dex::io::CSVWriter::Close ( ) throws System.IO.IOException, System.ApplicationException

Closes the writer.

Exceptions:
System.IO.IOExceptionIf the close fails.
System.ApplicationExceptionnull

Reimplemented from com::sparsity::dex::io::RowWriter.

void com::sparsity::dex::io::CSVWriter::Open ( System.String  f) throws System.IO.IOException

Opens the output file path.

Parameters:
f[in] Output file path.
Exceptions:
System.IO.IOExceptionIf bad things happen opening the file.
void com::sparsity::dex::io::CSVWriter::SetAutoQuotes ( bool  autoquotes)

Sets on/off the automatic quote mode.

If there are forced quotes, setting autoquotes on will clear them. If the autoquotes is set to off and no forced quotes are provided, there will not be any quote.

Parameters:
autoquotes[in] If TRUE it enables the automatic quote mode, if FALSE it disables it.
void com::sparsity::dex::io::CSVWriter::SetForcedQuotes ( com.sparsity.dex.gdb.BooleanList  forcequotes)

Disables the automatic quote mode and forces to be quoted those positions set to TRUE in the given vector.

Parameters:
forcequotes[in] A booleanList with the position for each column that must be quoted set to true.
void com::sparsity::dex::io::CSVWriter::SetLocale ( System.String  localeStr)

Sets the locale that will be used to write the file.

Parameters:
localeStr[in] The locale string for the file encoding.
void com::sparsity::dex::io::CSVWriter::SetQuotes ( System.String  quotes) throws System.ApplicationException

Sets the character used to quote fields.

Parameters:
quotes[in] Quote character.
Exceptions:
System.ApplicationExceptionnull
void com::sparsity::dex::io::CSVWriter::SetSeparator ( System.String  sep) throws System.ApplicationException

Sets the character used to separate fields in the file.

Parameters:
sep[in] Separator character.
Exceptions:
System.ApplicationExceptionnull
void com::sparsity::dex::io::CSVWriter::Write ( com.sparsity.dex.gdb.StringList  row) throws System.IO.IOException, System.ApplicationException

Writes the next row.

Parameters:
row[in] Row of data.
Exceptions:
System.IO.IOExceptionIf bad things happen during the write.
System.ApplicationExceptionnull

Reimplemented from com::sparsity::dex::io::RowWriter.