Extensions.File.OpenFileForRead

From emotive
Jump to navigation Jump to search

Classification

Name OpenFileForRead
Short Description Opens a File and returns a file handle to this file
Class Term
Extension OTX File extension
Group File related Terms
Exceptions FileLockException
FileNotFoundException
FileOpenException
Checker Rules -
Standard Compliant Yes

OTL Syntax

FileReadHandleTerm File.OpenFileForRead(StringTerm path, EncodingTerm encoding);

Description

The OpenFileForRead activity opens a File on the specified path with read access and returns a file handle to this file. If a file is opened for reading it shall be automatically locked against writing. Simultaneous reading of the same file is possible.

Return Value

The Term returns the value, see table below.

Icons Note.png In OTX, Terms are categorized according to its return data type!
Data Type Description
FileReadHandle Returns a file handle for the file in the specified path.

Properties

Name Data Type Class Default Cardinality Description
Encoding Encoding Term - [0..1] This represents the encoding to be used. The set of standard encodings which shall be supported by any runtime system is given by the Encoding enumeration in StringUtil extension. If the encoding is not specified, it assumes that Strings will be encoded using UTF-8. The encodings HEX, BIN, OCT are not allowed.
Path String Term - [1..1] The file to open. The path parameter is permitted to specify relative or absolute path information.

OTL Examples

/// Local Declarations

File.FileReadHandle FileReadHandle1;

/// Flow

FileReadHandle1 = File.OpenFileForRead("file:///D:/abc.txt", @Encoding:UTF-8);

See also

CreateTempDirectory
GetFilePath
GetFilesFromDirectory
GetFileSize
IsDirectory
IsEndOfFileReached
IsFile
OpenFileForWrite
ReadBytes
ReadFile
ReadLine