Public Member Functions

alma.acs.logging.tools.CSVConverter Class Reference

Inheritance diagram for alma.acs.logging.tools.CSVConverter:
alma.acs.logging.tools.LogConverter alma.acs.logging.tools.TextConverter alma.acs.logging.tools.TwikiTableConverter

List of all members.

Public Member Functions

 CSVConverter (String cols)
 CSVConverter ()
 CSVConverter (String cols, char separator, boolean doubleQuotes)
void setSeparator (char sep)
void encloseByDoubleQuotes (boolean enclose)
String getHeader ()
String convert (ILogEntry log)

Detailed Description

Objects of this class produce a CSV string from a given log. The CSV adhere to the definition in RFC4180.

It is possible to select the columns of the log to export and their positions by setting a string.

A method generate the header in CSV format

All the fields appear inside double quotes. If a field contains double quotes they are escaped by double quotes. It is also possible not to enclose the fields by double quotes but in that case the content of the field is changed because some character are not allowed.

It is possible to define a different separator instead of a comma, like for example the TAB.

Author:
acaproni

Constructor & Destructor Documentation

alma.acs.logging.tools.CSVConverter.CSVConverter ( String  cols  ) 

Constructor

Parameters:
cols A string describing the field of the log and their position in the output
alma.acs.logging.tools.CSVConverter.CSVConverter (  ) 

Constructor.

The converted string contains all the fields just once and the additional data.

alma.acs.logging.tools.CSVConverter.CSVConverter ( String  cols,
char  separator,
boolean  doubleQuotes 
)

Constructor

Parameters:
cols A string describing the field of the log and their position in the output
separator A character to use as fields separator
doubleQuotes If true the fields are enclosed by double quotes

Member Function Documentation

String alma.acs.logging.tools.CSVConverter.convert ( ILogEntry  log  )  [virtual]
void alma.acs.logging.tools.CSVConverter.encloseByDoubleQuotes ( boolean  enclose  ) 

Put or remove the double quotes around the fields

Parameters:
enclose If true the fields are enclosed by double quotes
String alma.acs.logging.tools.CSVConverter.getHeader (  )  [virtual]

Generate the header for the CSV file (it is optional and can appear in the first line of the file)

Returns:
The CSV string representing the header in CSV format with CR/LF at the end of the line

Implements alma.acs.logging.tools.LogConverter.

Reimplemented in alma.acs.logging.tools.TwikiTableConverter.

References alma.acs.logging.tools.LogConverter.colIndex.

void alma.acs.logging.tools.CSVConverter.setSeparator ( char  sep  ) 

Set the separator

Parameters:
sep The new separator char

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties