class util::CsvOutStream

sys::Obj
  sys::OutStream
    util::CsvOutStream

@Js

Source

CsvOutStream is used to write delimiter-separated values as specified by RFC 4180. Format details:

  • rows are delimited by a newline
  • cells are separated by delimiter char
  • cells containing the delimiter, " double quote, or newline are quoted; quotes are escaped as ""

Also see CsvInStream.

delimiter

Int delimiter := 44

Source

Delimiter character; defaults to comma.

isQuoteRequired

Bool isQuoteRequired(Str cell)

Source

Return if the given cell string contains:

  • the configured delimiter
  • double quote " char
  • leading/trailing whitespace
  • newlines
make

new make(OutStream out)

Source

Wrap the underlying output stream.

writeCell

virtual This writeCell(Str cell)

Source

Write a single cell. If isQuoteRequired returns true, then quote it.

writeRow

virtual This writeRow(Str[] row)

Source

Write the row of cells with the configured delimiter. Also see writeCell.