org.apache.camel.dataformat.csv
Class CsvDataFormat

java.lang.Object
  extended by org.apache.camel.dataformat.csv.CsvDataFormat
All Implemented Interfaces:
DataFormat

public class CsvDataFormat
extends Object
implements DataFormat

CSV Data format.

By default, columns are autogenerated in the resulting CSV. Subsequent messages use the previously created columns with new fields being added at the end of the line. Thus, field order is the same from message to message. Autogeneration can be disabled. In this case, only the fields defined in csvConfig are written on the output.

Version:
$Revision: 763551 $

Constructor Summary
CsvDataFormat()
           
 
Method Summary
protected  org.apache.commons.csv.writer.CSVConfig createConfig()
           
 org.apache.commons.csv.CSVStrategy getStrategy()
           
 boolean isAutogenColumns()
           
 void marshal(Exchange exchange, Object object, OutputStream outputStream)
           
 void setAutogenColumns(boolean autogenColumns)
          Auto generate columns.
 void setConfig(org.apache.commons.csv.writer.CSVConfig config)
           
 void setStrategy(org.apache.commons.csv.CSVStrategy strategy)
           
 Object unmarshal(Exchange exchange, InputStream inputStream)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CsvDataFormat

public CsvDataFormat()
Method Detail

marshal

public void marshal(Exchange exchange,
                    Object object,
                    OutputStream outputStream)
             throws Exception
Specified by:
marshal in interface DataFormat
Throws:
Exception

unmarshal

public Object unmarshal(Exchange exchange,
                        InputStream inputStream)
                 throws Exception
Specified by:
unmarshal in interface DataFormat
Throws:
Exception

setConfig

public void setConfig(org.apache.commons.csv.writer.CSVConfig config)

getStrategy

public org.apache.commons.csv.CSVStrategy getStrategy()

setStrategy

public void setStrategy(org.apache.commons.csv.CSVStrategy strategy)

isAutogenColumns

public boolean isAutogenColumns()

setAutogenColumns

public void setAutogenColumns(boolean autogenColumns)
Auto generate columns.

Parameters:
autogenColumns - set to false to disallow column autogeneration (default true)

createConfig

protected org.apache.commons.csv.writer.CSVConfig createConfig()


Apache CAMEL