Difference between revisions of "Extensions.File.CloseFile"

From emotive
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:OTX '''CloseFile'''}}Category:File == Classification == {{ClassificationActivity | CloseFile | UPDATING... | Action | Extensions.File|OTX File extensi...")
 
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{DISPLAYTITLE:OTX '''CloseFile'''}}[[Category:File]]
 
{{DISPLAYTITLE:OTX '''CloseFile'''}}[[Category:File]]
 
== Classification ==
 
== Classification ==
{{ClassificationActivity | CloseFile | UPDATING... | [[Action]] | [[Extensions.File|OTX File extension]] | UPDATING... | UPDATING... | UPDATING... }}
+
{{ClassificationActivity | CloseFile | Closes the current file | [[Action]] | [[Extensions.File|OTX File extension]] | [[Extensions.File#Actions|File related Actions]]| [[Extensions.File.FileSaveException|FileSaveException]] <br/> [[Core.DataTypes.ComplexDataType.InvalidReferenceException|InvalidReferenceException]] | -|}}
  
 
== OTL Syntax ==
 
== OTL Syntax ==
UPDATING...<!--
 
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
DiagCom.CloseComChannel(ComChannelVariable);
+
File.CloseFile(FileHandleVariable handle);
 
</syntaxhighlight>
 
</syntaxhighlight>
-->
 
  
 
== Description ==
 
== Description ==
UPDATING...<!--
+
The '''CloseFile''' closes the current file and releases any resources associated with the current file. In the case of a [[Extensions.File.FileWriteHandle|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 [[Extensions.File.FileWriteHandle|FileWriteHandle]].
OTX CloseComChannel activity is used for the [[Diagnosis Runtime System]] to announce that an open communication channel that all relevant resources can be released and closed.
+
 
{{ComChannelMemoryUsageNote}}
+
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''']].
{{Important|Please note that the use of a shared '''ComChannel''' can bring the OTX runtime system in an undefined state and that is this case is not validated at design time!}}
 
-->
 
  
 
== Properties ==
 
== Properties ==
UPDATING...<!--
 
 
{| {{TableHeader}}
 
{| {{TableHeader}}
 
{{TableRowPropertiesHeader}}
 
{{TableRowPropertiesHeader}}
{{TableRowPropertie1| ComChannel | [[Extensions.DiagCom.ComChannel|ComChannel]] | [[Variable]] | - | [1] | Communication Channel (Control unit).}}
+
{{TableRowPropertie2| Handle| [[Extensions.File.FileHandle|FileHandle]] | [[Variable]] | - | [1..1] | The handle for the file that the related file object encapsulates.}}
 
|}
 
|}
-->
 
  
 
== OTL Examples ==
 
== OTL Examples ==
UPDATING...<!--
 
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
DiagCom.ComChannel myComCannel;
+
/// Local Declarations
 +
 
 +
File.FileReadHandle FileReadHandle;
  
myComCannel = DiagCom.GetComChannel("DiagnosticsCan_ECU_1", null, false);
+
/// Flow
  
// Code example using the variable myComChannel
+
FileReadHandle = File.OpenFileForRead("file:///D:/abc.txt", @Encoding:UTF-8);
// ...
+
File.CloseFile(FileReadHandle);
DiagCom.CloseComChannel(myComCannel);</syntaxhighlight>
 
 
</syntaxhighlight>
 
</syntaxhighlight>
-->
 
  
 
== See also ==
 
== See also ==
UPDATING...
+
<!--[[Extensions.File.CloseFile|CloseFile]] <br/>-->
 +
[[Extensions.File.DeleteDirectory|DeleteDirectory]]<br/>
 +
[[Extensions.File.DeleteFile|DeleteFile]]<br/>
 +
[[Extensions.File.SaveFile|SaveFile]]<br/>
 +
[[Extensions.File.WriteBytes|WriteBytes]]<br/>
 +
[[Extensions.File.WriteFile|WriteFile]]<br/>
 +
[[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