Skip to main content
Skip table of contents

Reading a File

You can use the Filesystem adapter to read data from a file in the filesystem.

Reading Line By Line

Using the readLine operation of the Filesystem adapter, you can read a file line by line.

Name

Type

Direction

Description

name

String

in

Fully qualified file name of the file you want to read, including the path.

When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\".
To avoid this, use forward slashes with Windows as well.

encoding

String

in

Encoding of the file. Default encoding is iso-8859-1.
For a list of possible encodings see Charset Definitions.

length

Integer

out

Length (in Bytes) of the line that has been read. On file end, length is 0.

line

String

out

File content of the line that has been read. On file end, line is NULL.

The path and file name of the file you want to access can be given dynamically via input parameter name, or statically via the definitions of an alias.

Reading a Complete File or Parts

Using the read operation of the Filesystem adapter, you can read a complete file in once, or specific parts of it.

Name

Type

Direction

Description

name

String

in

Fully qualified file name of the file you want to read, including the path.

When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\".
To avoid this, use forward slashes with Windows as well.

position

Integer

in

Position (in Bytes) from which you want to start reading the file.

length.in

Integer

in

Length (in Bytes) of the snippet of the file you want to read. The actual length of the read data is given back (e.g. on file end).

data

Blob

out

Content that has been read.

length.out

Integer

out

Length (in Bytes) of the snippet of the file you want to read. The actual length of the read data is given back (e.g. on file end).

The path and file name of the file you want to access can be given dynamically via input parameter name, or statically via the definitions of an alias. If you do not want to read the complete file, provide a starting position in parameter position and/or a snippet size in parameter length. You can use this parameters separately or in combination.

Closing a File

On end of the service request, all files that have been used with the Filesystem adapter are closed automatically. In some cases, it may be helpful to manually close a file (e.g. if you want to rename or push the file).
You can close a file using the close operation of the Filesystem adapter.

Name

Type

Direction

Description

name

String

in

Fully qualified file name of the file you want to close, including the path.

When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\".
To avoid this, use forward slashes with Windows as well.

The path and file name of the file you want to close can be given dynamically via input parameter name, or statically via the definitions of an alias

FilesystemAdapter_ProductExport_Example

Click here to download a simple example model that shows the usage of the Filesystem adapter in Scheer PAS Designer.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.