Skip to main content
Version: 2.18.x.x LTS

TextDataSink

The TextDataSink is used to write plain text files. It can be used to create a new file or to append an existing file. When the sink is opened, it can be configured to write header data to the file. In addition, it can be configured to write a footer when it is closed. The body data is written for every record passed to the sink.

Configuration

NameType, usage constraints, defaultsDescription
filenamerequired: paraVal
default: none
type: path to file
Name of the plaintext file to be written.
appendoptional: paraVal
default: false
type: boolean
Determines whether the data is appended to an existing file or whether the file should be overwritten (default).
bodyoptional: paraList
default: none
type: list of strings
Data to be written of for every record. The entries of the list are concatenated.
headeroptional: paraList
default: none
type: list of strings
Data to be written at the beginning of the file. The entries of the list are concatenated.
footeroptional: paraList
default: none
type: list of strings
Data to be written at the end of the file. The entries of the list are concatenated.
encodingoptional: paraVal
default: default encoding
type: string
The name of the character set that should be used to encode the file. The available values depend on the version and vendor of the JVM. Examples: UTF-8, ISO-8859-1, UTF-16LE

Example

<dataSink type="TextDataSink">
<dp:paraVal name="filename" value="#{cfg.filename}" />
<dp:paraList name="header">
<value>User Addressed
==============
</value>
</dp:paraList>
<dp:paraList name="body">
<value><![CDATA[
#{in.user.firstName}
#{in.user.name}
#{in.user.address}
#{in.user.zip}
#{in.user.place}]]>
</value>
</dp:paraList>
<dp:paraList name="footer">
<value>Written: #{date:now()}&#xA;
</value>
</dp:paraList>
</dataSink>