Reading a File Line by Line
This page explains the Filesystem Adapter in Bridge context. If you were looking for the same information regarding the PAS Designer, refer to Filesystem Adapter in the Designer guide.
Parameters of Action "readLine"
Name | Type | Direction | Description |
---|---|---|---|
name | String | in | Fully qualified file name of the file you want to read, including the path. |
encoding | String | in | Encoding of the file. Default encoding is iso-8859-1. For a list of possible encodings see Charset Definitions. |
line | String | out | File content of the line that has been read. On file end, line is NULL. |
length | Integer | out | Length (in Bytes) of the line that has been read. On file end, length is 0. |
Defining a "readLine" Action
To read a file line by line with the file system adapter, you need to define a readLine action on an action having the stereotype <<FileSystemAdapter>>. You can do this manually (refer to Figure: The Specification Dialog of the File System Adapter) or with the help of the E2E Action Wizard (see context menu of the action node).
Figure: Reading a File Line by Line
The file content line is of the base type String and is stored in an output object named line. If line is not given back by the file system adapter (line=NULL), the end of file has been reached.
The path and file name of the file you want to access are defined in the component diagram. The link from the activity diagram to the physical information is established by an alias (in the present example: FileAlias). See File System Components for more information on file system aliases.
For information on how to access a file or directory dynamically refer to Dynamic File System Access.
Related Pages: