org.apache.camel.impl
Class StringDataFormat

java.lang.Object
  extended by org.apache.camel.impl.StringDataFormat
All Implemented Interfaces:
DataFormat

public class StringDataFormat
extends Object
implements DataFormat

The text based data format supporting charset encoding.

Version:
$Revision: 3009 $

Constructor Summary
StringDataFormat(String charset)
           
 
Method Summary
 void marshal(Exchange exchange, Object graph, OutputStream stream)
          Marshals the object to the given Stream.
 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

StringDataFormat

public StringDataFormat(String charset)
Method Detail

marshal

public void marshal(Exchange exchange,
                    Object graph,
                    OutputStream stream)
             throws IOException
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:
IOException

unmarshal

public Object unmarshal(Exchange exchange,
                        InputStream stream)
                 throws IOException
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:
IOException


Apache CAMEL