Extensions.File.ReadBytes
Jump to navigation
Jump to search
Contents
Classification
Name | ReadBytes |
Short Description | Reads bytes from the specified file |
Class | Term |
Extension | OTX File extension |
Group | File related Terms |
Exceptions | FileAccessException FileFormatException FileLockException OutOfBoundsException |
Checker Rules | - |
Standard Compliant | Yes |
OTL Syntax
ByteFieldTerm File.ReadBytes(FileReadHandleTerm handle, IntegerTerm index, IntegerTerm count);
Description
The ReadBytes activity reads bytes from the file specified in the file handle and returns a ByteField. 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. If index + count > file size, a ByteField containing the remaining bytes shall be returned.
Return Value
The Term returns the value, see table below.
In OTX, Terms are categorized according to its return data type!
Data Type | Description |
ByteField | Returns the bytes from the specified file as a ByteField. |
Properties
Name | Data Type | Class | Default | Cardinality | Description |
Handle | FileReadHandle | Term | - | [1..1] | The handle to the file that the related file object encapsulates. |
Index | Integer | Term | - | [0..1] | Index for reading. If index is omitted, start reading at index of the first unread byte. |
Count | Integer | Term | - | [0..1] | The number of bytes to read. If count is omitted, read until the end of the file. |
OTL Examples
/// Local Declarations
File.FileReadHandle FileReadHandle1;
ByteField ByteField1;
/// Flow
FileReadHandle1 = File.OpenFileForRead("file:///D:/abc.txt", @Encoding:UTF-8);
ByteField1 = File.ReadBytes(FileReadHandle1);
See also
CreateTempDirectory
GetFilePath
GetFilesFromDirectory
GetFileSize
IsDirectory
IsEndOfFileReached
IsFile
OpenFileForRead
OpenFileForWrite
ReadFile
ReadLine