Difference between revisions of "Extensions.File.ReadLine"

From emotive
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:OTX '''ReadLine'''}}Category:File == Classification == {{ClassificationActivity | ReadLine | UPDATING... | Term | OTX File extension...")
 
Line 1: Line 1:
 
{{DISPLAYTITLE:OTX '''ReadLine'''}}[[Category:File]]
 
{{DISPLAYTITLE:OTX '''ReadLine'''}}[[Category:File]]
 
== Classification ==
 
== Classification ==
{{ClassificationActivity | ReadLine | UPDATING... | [[Term]] | [[Extensions.File|OTX File extension]] | UPDATING... | UPDATING... | UPDATING... }}
+
{{ClassificationActivity | ReadLine| Reads the next line of characters from the 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 ==
UPDATING...<!--
 
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
DiagCom.CloseComChannel(ComChannelVariable);
+
StringTerm = File.ReadLine(FileReadHandleTerm);
 
</syntaxhighlight>
 
</syntaxhighlight>
-->
 
  
 
== Description ==
 
== Description ==
UPDATING...<!--
+
The '''ReadLine''' activity reads the next line of characters from the file and returns the data as a String. The line is terminated either by a recognised line break (any of ‘\r\n’, ‘\r’ or ‘\n’) or by reaching the end of the file. The line break is not included in the returned string. The first read 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''']].
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}}
+
{{TermReturnValue| [[Core.DataTypes.SimpleDataType.String|String]] | Returns the next line of characters from the file as a String.}}
{{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.FileReadHandle|FileReadHandle]] | [[Term]] | - | [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;
+
File.FileReadHandle FileReadHandle1;
 +
String String1;
  
myComCannel = DiagCom.GetComChannel("DiagnosticsCan_ECU_1", null, false);
+
/// Flow
  
// Code example using the variable myComChannel
+
FileReadHandle1 = File.OpenFileForRead("file:///D:/abc.txt", @Encoding:UTF-8);
// ...
+
String1 = File.ReadLine(FileReadHandle1);
DiagCom.CloseComChannel(myComCannel);</syntaxhighlight>
 
 
</syntaxhighlight>
 
</syntaxhighlight>
-->
 
  
 
== See also ==
 
== See also ==
UPDATING...
+
[[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]]-->

Revision as of 10:43, 27 September 2018

Classification

Name ReadLine
Short Description Reads the next line of characters from the file
Class Term
Extension OTX File extension
Group File related Terms
Exceptions FileAccessException
FileFormatException
FileLockException
OutOfBoundsException
Checker Rules -
Standard Compliant Yes

OTL Syntax

StringTerm = File.ReadLine(FileReadHandleTerm);

Description

The ReadLine activity reads the next line of characters from the file and returns the data as a String. The line is terminated either by a recognised line break (any of ‘\r\n’, ‘\r’ or ‘\n’) or by reaching the end of the file. The line break is not included in the returned string. The first read activity on a file handle defines if an access shall be realized by line, bytes or file. Mixed access will lead to a FileFormatException.

Return Value

The Term returns the value, see table below.

Icons Note.png In OTX, Terms are categorized according to its return data type!
Data Type Description
String Returns the next line of characters from the file as a String.

Properties

Name Data Type Class Default Cardinality Description
handle FileReadHandle Term - [1..1] The handle for the file that the related file object encapsulates.

OTL Examples

File.FileReadHandle FileReadHandle1;
String String1;

/// Flow

FileReadHandle1 = File.OpenFileForRead("file:///D:/abc.txt", @Encoding:UTF-8);
String1 = File.ReadLine(FileReadHandle1);

See also

CreateTempDirectory
GetFilePath
GetFilesFromDirectory
GetFileSize
IsDirectory
IsEndOfFileReached
IsFile
OpenFileForRead
OpenFileForWrite
ReadBytes
ReadFile