...
The CSV Data Format uses Apache Commons CSV to handle CSV payloads (Comma Separated Values) such as those exported/imported by Excel.
...
As of Camel 2.15.0, it now uses the Apache Commons CSV 1.1 which is based on a completely different set of options.
Available options until Camel 2.15
Option | Type | Description |
---|---|---|
config | CSVConfig | Can be used to set a custom |
strategy | CSVStrategy | Can be used to set a custom |
autogenColumns | boolean | Whether or not columns are auto-generated in the resulting CSV. The default value is |
delimiter | String | Camel 2.4: The column delimiter to use; the default value is " |
skipFirstLine | boolean | Camel 2.10: Whether or not to skip the first line of CSV input when unmarshalling (e.g. if the content has headers on the first line); the default value is |
lazyLoad | boolean | Camel 2.12.2: Whether or not to Sequential access CSV input through an iterator which could avoid OOM exception when processing huge CSV file; the default value is false |
useMaps | boolean | Camel 2.13: Whether to use List<Map> when unmarshalling instead of List<List>. |
Available options as of Camel 2.15
Option | Type | Description | |||||
---|---|---|---|---|---|---|---|
format | CSVFormat | The reference format to use, it will be updated with the other format options, the default value is CSVFormat.DEFAULT | |||||
formatName | String | Used in order to initialize the reference format using the name of one of the default formats. The possible values are: | |||||
commentMarker | Character | Overrides the comment marker of the reference format. This option is | |||||
delimiter | Character | Overrides the delimiter of the reference format. This option is | |||||
escapeDisabled | boolean | Disables the escape character of the reference format. This option is | |||||
escape | Character | Overrides the escape character of the reference format. This option is | |||||
headerDisabled | boolean | Disables the header of the reference format. This option is | |||||
header | String[] | Overrides the header of the reference format. This option is In the XML DSL, this option is configured using children
| |||||
allowMissingColumnNames | Boolean | Overrides the missing column names behavior of the reference format. This option is | |||||
ignoreEmptyLines | Boolean | Overrides the empty line behavior of the reference format. This option is | |||||
ignoreSurroundingSpaces | Boolean | Overrides the surrounding spaces behavior of the reference format. This option is | |||||
nullStringDisabled | boolean | Disables the null string representation of the reference format. This option is | |||||
nullString | String | Overrides the null string representation of the reference format. This option is | |||||
quoteDisabled | boolean | Disables the quote of the reference format. This option is | |||||
quote | Character | Overrides the quote symbol of the reference format. This option is | |||||
quoteMode | QuoteMode | Overrides the quote mode of the reference format. This option is | |||||
recordSeparatorDisabled | boolean | Disables the record separator of the reference format. This option is | |||||
recordSeparator | String | Overrides the record separator of the reference format. This option is | |||||
skipHeaderRecord | Boolean | Overrides the header record behavior of the reference format. This option is | |||||
lazyLoad | boolean | Whether the unmarshalling should produce an iterator that reads the lines on the fly or if all the lines must be read at one. This option is | |||||
useMaps | boolean | Whether the unmarshalling should produce maps for the lines values instead of lists. It requires to have header (either defined or collected). This options is | |||||
recordConverter | CsvRecordConverter | Sets the record converter to use. If defines the This option is |
Marshalling a Map to CSV
The component allows you to marshal a Java Map (or any other message type that can be converted in a Map) into a CSV payload.
An example: if you send a message with this map...
Wiki Markup |
---|
{snippet:id=marshalInput|lang=java|url=camel/trunk/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvRouteTest.java} |
...