org.apache.camel.component.flatpack
Class FlatpackDataFormat

java.lang.Object
  extended by org.apache.camel.component.flatpack.FlatpackDataFormat
All Implemented Interfaces:
DataFormat

public class FlatpackDataFormat
extends Object
implements DataFormat

Flatpack DataFormat.

This data format supports two operations:

Notice: The Flatpack library does currently not support header and trailers for the marshal operation.

Version:

Constructor Summary
FlatpackDataFormat()
           
 
Method Summary
protected  net.sf.flatpack.Parser createParser(Exchange exchange, Reader bodyReader)
           
 org.springframework.core.io.Resource getDefinition()
           
 char getDelimiter()
           
 net.sf.flatpack.ParserFactory getParserFactory()
           
 char getTextQualifier()
           
 boolean isFixed()
           
 boolean isIgnoreFirstRecord()
           
 void marshal(Exchange exchange, Object graph, OutputStream stream)
          Marshals the object to the given Stream.
 void setDefinition(org.springframework.core.io.Resource definition)
           
 void setDelimiter(char delimiter)
           
 void setFixed(boolean fixed)
           
 void setIgnoreFirstRecord(boolean ignoreFirstRecord)
           
 void setParserFactory(net.sf.flatpack.ParserFactory parserFactory)
           
 void setTextQualifier(char textQualifier)
           
 Object unmarshal(Exchange exchange, InputStream stream)
          Unmarshals the given stream into an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlatpackDataFormat

public FlatpackDataFormat()
Method Detail

marshal

public void marshal(Exchange exchange,
                    Object graph,
                    OutputStream stream)
             throws Exception
Description copied from interface: DataFormat
Marshals the object to the given Stream.

Specified by:
marshal in interface DataFormat
Parameters:
exchange - the current exchange
graph - the object to be marshalled
stream - the output stream to write the marshalled result to
Throws:
Exception - can be thrown

unmarshal

public Object unmarshal(Exchange exchange,
                        InputStream stream)
                 throws Exception
Description copied from interface: DataFormat
Unmarshals the given stream into an object.

Notice: The result is set as body on the exchange OUT message. It is possible to mutate the OUT message provided in the given exchange parameter. For instance adding headers to the OUT message will be preserved.

Specified by:
unmarshal in interface DataFormat
Parameters:
exchange - the current exchange
stream - the input stream with the object to be unmarshalled
Returns:
the unmarshalled object
Throws:
Exception - can be thrown

isFixed

public boolean isFixed()

setFixed

public void setFixed(boolean fixed)

getDelimiter

public char getDelimiter()

setDelimiter

public void setDelimiter(char delimiter)

isIgnoreFirstRecord

public boolean isIgnoreFirstRecord()

setIgnoreFirstRecord

public void setIgnoreFirstRecord(boolean ignoreFirstRecord)

getTextQualifier

public char getTextQualifier()

setTextQualifier

public void setTextQualifier(char textQualifier)

getDefinition

public org.springframework.core.io.Resource getDefinition()

setDefinition

public void setDefinition(org.springframework.core.io.Resource definition)

getParserFactory

public net.sf.flatpack.ParserFactory getParserFactory()

setParserFactory

public void setParserFactory(net.sf.flatpack.ParserFactory parserFactory)

createParser

protected net.sf.flatpack.Parser createParser(Exchange exchange,
                                              Reader bodyReader)
                                       throws IOException
Throws:
IOException


Apache CAMEL