Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the early version of the new website
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.

Base64 Data Format

Available as of Camel 2.11
The Base64 Data Format is a data format for base64 encoding and decoding.







To specific a maximum line length for the encoded data.



The line separators to use.



Instead of emitting '+' and '/' we emit '-' and '_' respectively. urlSafe is only applied to encode operations. Decoding seamlessly handles both modes.

In Spring DSL, you configure the data format using this tag:

        <!-- for a newline character (\n), use the HTML entity notation coupled with the ASCII code. -->
        <base64 lineSeparator="&#10;" id="base64withNewLine" />
        <base64 lineLength="64" id="base64withLineLength64" />

Then you can use it later by its reference:

     <from uri="direct:startEncode" />
     <marshal ref="base64withLineLength64" />
     <to uri="mock:result" />
Most of the time, you won't need to declare the data format if you use the default options. In that case, you can declare the data format inline as shown below.


In this example we marshal the file content to base64 object.


In Spring DSL:

 <from uri="file://data.bin">
 <to uri="jms://myqueue"/> 


In this example we unmarshal the payload from the JMS queue to a byte[] object, before its processed by the newOrder processor.


In Spring DSL:

 <from uri="jms://queue/order">
 <to uri="bean:newOrder"/> 


To use Base64 in your Camel routes you need to add a dependency on camel-base64 which implements this data format.

If you use Maven you can just add the following to your pom.xml:

  <version>x.x.x</version>  <!-- use the same version as your Camel core version -->
© 2004-2015 The Apache Software Foundation.
Apache Camel, Camel, Apache, the Apache feather logo, and the Apache Camel project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram