org.apache.camel.dataformat.csv
Class CsvDataFormat

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

public class CsvDataFormat
extends Object
implements org.apache.camel.spi.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:

Constructor Summary
CsvDataFormat()
           
 
Method Summary
 org.apache.commons.csv.writer.CSVConfig getConfig()
           
 String getDelimiter()
           
 org.apache.commons.csv.CSVStrategy getStrategy()
           
 boolean isAutogenColumns()
           
 boolean isLazyLoad()
           
 boolean isSkipFirstLine()
           
 boolean isUseMaps()
           
 void marshal(org.apache.camel.Exchange exchange, Object object, OutputStream outputStream)
           
 void setAutogenColumns(boolean autogenColumns)
          Auto generate columns.
 void setConfig(org.apache.commons.csv.writer.CSVConfig config)
           
 void setDelimiter(String delimiter)
           
 void setLazyLoad(boolean lazyLoad)
           
 void setSkipFirstLine(boolean skipFirstLine)
           
 void setStrategy(org.apache.commons.csv.CSVStrategy strategy)
           
 void setUseMaps(boolean useMaps)
          Sets whether or not the result of the unmarshalling should be a java.util.Map instead of a java.util.List.
 Object unmarshal(org.apache.camel.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(org.apache.camel.Exchange exchange,
                    Object object,
                    OutputStream outputStream)
             throws Exception
Specified by:
marshal in interface org.apache.camel.spi.DataFormat
Throws:
Exception

unmarshal

public Object unmarshal(org.apache.camel.Exchange exchange,
                        InputStream inputStream)
                 throws Exception
Specified by:
unmarshal in interface org.apache.camel.spi.DataFormat
Throws:
Exception

getDelimiter

public String getDelimiter()

setDelimiter

public void setDelimiter(String delimiter)

getConfig

public org.apache.commons.csv.writer.CSVConfig getConfig()

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)

isSkipFirstLine

public boolean isSkipFirstLine()

setSkipFirstLine

public void setSkipFirstLine(boolean skipFirstLine)

isLazyLoad

public boolean isLazyLoad()

setLazyLoad

public void setLazyLoad(boolean lazyLoad)

isUseMaps

public boolean isUseMaps()

setUseMaps

public void setUseMaps(boolean useMaps)
Sets whether or not the result of the unmarshalling should be a java.util.Map instead of a java.util.List. It uses the first line as a header line and uses it as keys of the maps.

Parameters:
useMaps - true in order to use java.util.Map instead of java.util.List, false otherwise.


Apache Camel