Difference between revisions of "Extensions.File.ReadBytes"
Jump to navigation
Jump to search
(2 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
== OTL Syntax == | == OTL Syntax == | ||
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | <syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | ||
− | ByteFieldTerm | + | ByteFieldTerm File.ReadBytes(FileReadHandleTerm handle, IntegerTerm index, IntegerTerm count); |
</syntaxhighlight> | </syntaxhighlight> | ||
Line 16: | Line 16: | ||
{| {{TableHeader}} | {| {{TableHeader}} | ||
{{TableRowPropertiesHeader}} | {{TableRowPropertiesHeader}} | ||
− | {{TableRowPropertie2| | + | {{TableRowPropertie2| Handle| [[Extensions.File.FileReadHandle|FileReadHandle]] | [[Term]] | - | [1..1] |The handle to the file that the related file object encapsulates.}} |
− | {{TableRowPropertie1| | + | {{TableRowPropertie1| Index| [[Core.DataTypes.SimpleDataType.Integer|Integer]] | [[Term]] | - | [0..1] |Index for reading. If index is omitted, start reading at index of the first unread byte.}} |
− | {{TableRowPropertie2| | + | {{TableRowPropertie2| Count|[[Core.DataTypes.SimpleDataType.Integer|Integer]] | [[Term]] | - | [0..1] |The number of bytes to read. If count is omitted, read until the end of the file.}} |
|} | |} | ||
== OTL Examples == | == OTL Examples == | ||
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | <syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | ||
+ | /// Local Declarations | ||
+ | |||
File.FileReadHandle FileReadHandle1; | File.FileReadHandle FileReadHandle1; | ||
ByteField ByteField1; | ByteField ByteField1; |
Latest revision as of 10:31, 2 November 2018
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