Difference between revisions of "Extensions.File.ReadBytes"
Jump to navigation
Jump to search
(Created page with "{{DISPLAYTITLE:OTX '''ReadBytes'''}}Category:File == Classification == {{ClassificationActivity | ReadBytes | UPDATING... | Term | Extensions.File|OTX File extension...") |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:OTX '''ReadBytes'''}}[[Category:File]] | {{DISPLAYTITLE:OTX '''ReadBytes'''}}[[Category:File]] | ||
== Classification == | == Classification == | ||
− | {{ClassificationActivity | ReadBytes | | + | {{ClassificationActivity | ReadBytes| Reads bytes from the specified file | [[Term]] | [[Extensions.File|OTX File extension]] | [[Extensions.File#Terms|File related Terms]]| [[Extensions.File.FileAccessException|FileAccessException]] <br/>[[Extensions.File.FileFormatException|FileFormatException]] <br/> [[Extensions.File.FileLockException|FileLockException]]<br/> [[Core.DataTypes.ComplexDataType.OutOfBoundsException|OutOfBoundsException]]| - |}} |
== OTL Syntax == | == OTL Syntax == | ||
− | |||
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | <syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | ||
− | + | ByteFieldTerm File.ReadBytes(FileReadHandleTerm handle, IntegerTerm index, IntegerTerm count); | |
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
== Description == | == Description == | ||
− | + | The '''ReadBytes''' activity reads bytes from the file specified in the file handle and returns a [[Core.DataTypes.ComplexDataType.ByteField|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 [[Extensions.File.FileFormatException|'''FileFormatException''']]. If index + count > file size, a [[Core.DataTypes.ComplexDataType.ByteField|ByteField]] containing the remaining bytes shall be returned. | |
− | + | ||
− | + | {{TermReturnValue| [[Core.DataTypes.ComplexDataType.ByteField|ByteField]] | Returns the bytes from the specified file as a ByteField.}} | |
− | {{ | ||
− | |||
== Properties == | == Properties == | ||
− | |||
{| {{TableHeader}} | {| {{TableHeader}} | ||
{{TableRowPropertiesHeader}} | {{TableRowPropertiesHeader}} | ||
− | {{TableRowPropertie1| | + | {{TableRowPropertie2| Handle| [[Extensions.File.FileReadHandle|FileReadHandle]] | [[Term]] | - | [1..1] |The handle to the file that the related file object encapsulates.}} |
+ | {{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| 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; | ||
+ | ByteField ByteField1; | ||
− | + | /// Flow | |
− | // | + | FileReadHandle1 = File.OpenFileForRead("file:///D:/abc.txt", @Encoding:UTF-8); |
− | // . | + | ByteField1 = File.ReadBytes(FileReadHandle1); |
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
== See also == | == See also == | ||
− | + | [[Extensions.File.CreateTempDirectory|CreateTempDirectory]]<br/> | |
+ | [[Extensions.File.GetFilePath|GetFilePath]]<br/> | ||
+ | [[Extensions.File.GetFilesFromDirectory|GetFilesFromDirectory]]<br/> | ||
+ | [[Extensions.File.GetFileSize|GetFileSize]]<br/> | ||
+ | [[Extensions.File.IsDirectory|IsDirectory]]<br/> | ||
+ | [[Extensions.File.IsEndOfFileReached|IsEndOfFileReached]]<br/> | ||
+ | [[Extensions.File.IsFile|IsFile]]<br/> | ||
+ | [[Extensions.File.OpenFileForRead|OpenFileForRead]]<br/> | ||
+ | [[Extensions.File.OpenFileForWrite|OpenFileForWrite]]<br/> | ||
+ | <!--[[Extensions.File.ReadBytes|ReadBytes]]<br/>--> | ||
+ | [[Extensions.File.ReadFile|ReadFile]]<br/> | ||
+ | [[Extensions.File.ReadLine|ReadLine]] |
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