Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Base64 Data Format

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

Options

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.

Marshal

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

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

Unmarshal

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

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

Dependencies

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:

Code Block
xml
xml
<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-base64</artifactId>
  <version>x.x.x</version>  <!-- use the same version as your Camel core version -->
</dependency>