Difference between revisions of "Extensions.File.CloseFile"
Jump to navigation
Jump to search
(5 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;"> | ||
− | File.CloseFile(FileHandleVariable); | + | File.CloseFile(FileHandleVariable handle); |
</syntaxhighlight> | </syntaxhighlight> | ||
Line 12: | Line 12: | ||
If a diagnostic sequence uses a [[Extensions.File.FileHandle|FileHandle]] after it has been closed by a '''CloseFile''' action, the runtime system shall throw an [[Core.DataTypes.ComplexDataType.InvalidReferenceException|'''otx:InvalidReferenceException''']]. | If a diagnostic sequence uses a [[Extensions.File.FileHandle|FileHandle]] after it has been closed by a '''CloseFile''' action, the runtime system shall throw an [[Core.DataTypes.ComplexDataType.InvalidReferenceException|'''otx:InvalidReferenceException''']]. | ||
− | |||
− | |||
== Properties == | == Properties == | ||
{| {{TableHeader}} | {| {{TableHeader}} | ||
{{TableRowPropertiesHeader}} | {{TableRowPropertiesHeader}} | ||
− | {{ | + | {{TableRowPropertie2| Handle| [[Extensions.File.FileHandle|FileHandle]] | [[Variable]] | - | [1..1] | The handle for the file that the related file object encapsulates.}} |
|} | |} | ||
== 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 FileReadHandle; | File.FileReadHandle FileReadHandle; | ||
Line 33: | Line 33: | ||
== See also == | == See also == | ||
<!--[[Extensions.File.CloseFile|CloseFile]] <br/>--> | <!--[[Extensions.File.CloseFile|CloseFile]] <br/>--> | ||
− | [[Extensions.File. | + | [[Extensions.File.DeleteDirectory|DeleteDirectory]]<br/> |
+ | [[Extensions.File.DeleteFile|DeleteFile]]<br/> | ||
[[Extensions.File.SaveFile|SaveFile]]<br/> | [[Extensions.File.SaveFile|SaveFile]]<br/> | ||
[[Extensions.File.WriteBytes|WriteBytes]]<br/> | [[Extensions.File.WriteBytes|WriteBytes]]<br/> | ||
[[Extensions.File.WriteFile|WriteFile]]<br/> | [[Extensions.File.WriteFile|WriteFile]]<br/> | ||
[[Extensions.File.WriteLine|WriteLine]] | [[Extensions.File.WriteLine|WriteLine]] |
Latest revision as of 09:54, 2 November 2018
Classification
Name | CloseFile |
Short Description | Closes the current file |
Class | Action |
Extension | OTX File extension |
Group | File related Actions |
Exceptions | FileSaveException InvalidReferenceException |
Checker Rules | - |
Standard Compliant | Yes |
OTL Syntax
File.CloseFile(FileHandleVariable handle);
Description
The CloseFile closes the current file and releases any resources associated with the current file. In the case of a FileWriteHandle, the file will be saved before closing. The use of CloseFile is optional. An OTX runtime system shall automatically close any open FileHandles at the end of a diagnostic session, saving the file in case of a FileWriteHandle.
If a diagnostic sequence uses a FileHandle after it has been closed by a CloseFile action, the runtime system shall throw an otx:InvalidReferenceException.
Properties
Name | Data Type | Class | Default | Cardinality | Description |
Handle | FileHandle | Variable | - | [1..1] | The handle for the file that the related file object encapsulates. |
OTL Examples
/// Local Declarations
File.FileReadHandle FileReadHandle;
/// Flow
FileReadHandle = File.OpenFileForRead("file:///D:/abc.txt", @Encoding:UTF-8);
File.CloseFile(FileReadHandle);
See also
DeleteDirectory
DeleteFile
SaveFile
WriteBytes
WriteFile
WriteLine