此内容没有您所选择的语言版本。

Chapter 310. String Encoding DataFormat


Available as of Camel version 2.12

The String Data Format is a textual based format that supports encoding.

310.1. Options

The String Encoding dataformat supports 2 options which are listed below.

Expand
NameDefaultJava TypeDescription

charset

 

String

Sets an encoding to use. Will by default use the JVM platform default charset.

contentTypeHeader

false

Boolean

Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.

310.2. Marshal

In this example we marshal the file content to String object in UTF-8 encoding.

from("file://data.csv").marshal().string("UTF-8").to("jms://myqueue");
Copy to Clipboard Toggle word wrap

310.3. Unmarshal

In this example we unmarshal the payload from the JMS queue to a String object using UTF-8 encoding, before its processed by the newOrder processor.

from("jms://queue/order").unmarshal().string("UTF-8").processRef("newOrder");
Copy to Clipboard Toggle word wrap

310.4. Dependencies

This data format is provided in camel-core so no additional dependencies is needed.

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat