Extensions.File.ReadFile
Jump to navigation
Jump to search
Contents
Classification
Name | ReadFile |
Short Description | Reads all lines of a specified file |
Class | Term |
Extension | OTX File extension |
Group | File related Terms |
Exceptions | FileAccessException FileFormatException FileLockException |
Checker Rules | - |
Standard Compliant | Yes |
OTL Syntax
StringTerm File.ReadFile(FileReadHandleTerm handle);
Description
The ReadFile activity reads all lines of a text file specified in the file handle and returns a String. The resulting string will contain line break characters as they were found in the file; no operation system specific conversion shall take place. Subsequent calls to ReadFile on the same handle will re-read the contents of the file.The first read or write activity on a file handle defines if an access shall be realized by line, bytes or file. Mixed access will lead to a FileFormatException.
Return Value
The Term returns the value, see table below.
In OTX, Terms are categorized according to its return data type!
Data Type | Description |
String | Returns all lines of the specified file as a String. |
Properties
Name | Data Type | Class | Default | Cardinality | Description |
Handle | FileReadHandle | Term | - | [1..1] | The handle for the file that the related file object encapsulates. |
OTL Examples
/// Local Declarations
File.FileReadHandle FileReadHandle1;
String String1;
/// Flow
FileReadHandle1 = File.OpenFileForRead("file:///D:/abc.txt", @Encoding:UTF-8);
String1 = File.ReadFile(FileReadHandle1);
See also
CreateTempDirectory
GetFilePath
GetFilesFromDirectory
GetFileSize
IsDirectory
IsEndOfFileReached
IsFile
OpenFileForRead
OpenFileForWrite
ReadBytes
ReadLine