Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Option

Default

Description

lineLength

76

To specific a maximum line length for the encoded data.

lineSeparator

\r\n

The line separators to use.

urlSafe

false

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

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

...

Code Block
languagexml
<route>
     <from uri="direct:startEncode" />
     <marshal ref="base64withLineLength64" />
     <to uri="mock:result" />
</route>
Info
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.

Marshal

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

Code Block
from("file://data.bin").marshal().base64().to("jms://myqueue");

In Spring DSL:

Code Block
languagexml
 <from uri="file://data.bin">
 <marshal>
     <base64/>
 </marshal>
 <to uri="jms://myqueue"/> 

...

Code Block
from("jms://queue/order").unmarshal().base64().processRef("newOrder");

In Spring DSL:

Code Block
languagexml
 <from uri="jms://queue/order">
 <marshal>
     <base64/>
 </marshal>
 <to uri="bean:newOrder"/> 

...