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
Name | Type, usage constraints, defaults | Description |
---|---|---|
filename | required: paraVal default: none type: path to file | Name of the plaintext file to be written. |
append | optional: paraVal default: false type: boolean | Determines whether the data is appended to an existing file or whether the file should be overwritten (default). |
body | optional: paraList default: none type: list of strings | Data to be written of for every record. The entries of the list are concatenated. |
header | optional: paraList default: none type: list of strings | Data to be written at the beginning of the file. The entries of the list are concatenated. |
footer | optional: paraList default: none type: list of strings | Data to be written at the end of the file. The entries of the list are concatenated. |
encoding | optional: 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()}

</value>
</dp:paraList>
</dataSink>