Public Member Functions | |
CSVConverter (String cols) | |
CSVConverter (String cols, char separator, boolean doubleQuotes) | |
void | setCols (String cols) |
void | setSeparator (char sep) |
void | encloseByDoubleQuotes (boolean enclose) |
String | getHeader () |
String | convert (ILogEntry log) |
Private Member Functions | |
void | appendField (String fld, StringBuilder str) |
String | formatData (Vector< ILogEntry.AdditionalData > datas) |
Private Attributes | |
String | colIndex = "01234567890abcdefg" |
char | separator = ',' |
boolean | useDoubleQuotes = true |
It is possible to select the column of the log to export and their position in the 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 possible to define a different separator instead of a come, like for example the TAB.
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.
|
Constructor
|
|
Constructor
|
|
Append a field to the string (str) The field is into double quotes. If double quotes exist into the string, they are escaped.
|
|
Convert a log in a CSV string
|
|
Put or remove the double quotes around the fields
|
|
Format the additional data in a string to be appended in the CSV. The produced string is not converted in CSV but contains all the entries of the additional data The format is the following: [name1 ==> val1] [name2 ==> val2] ....
|
|
Generate the header for the CSV file (it is optional and can appear in the first line of the file)
|
|
Set the fields of the log and their position in the output
|
|
Set the separator
|
|
|
|
|
|
|