Programming Reference for VirtualLab Fusion  2022.1
Public Member Functions | Static Public Attributes | List of all members
TextWriterFileHandler Class Reference

This class is subject to change. Programs using this class may require changes with a new version of VirtualLab.
Class for writing text to a file in an optimized way. A buffer is used to reduce file accesses, which speeds up the text writing. More...

Public Member Functions

virtual void EndFile ()
 Writes the buffer to the file, ends the file and closes all open ressources (e.g. the file stream).
 
 TextWriterFileHandler (string fileName, string headerInformation="")
 Standard constructor. More...
 
void Write (string lineString)
 Method to write a string to the file specified in the constructor. If you want to write multiple lines at once, you can also use this method and separate the lines with "\r\n". More...
 
void WriteLine (string lineString)
 Method to write a complete line to the file specified in the constructor. More...
 

Static Public Attributes

const int BufferSize
 Constant that defines the size of the buffer (in bytes, approximately the number of written characters). If the buffer is full, all data in the buffer is written to the file and the buffer is cleared. In this way, file accesses are reduced which increases the performance.
 

Detailed Description

This class is subject to change. Programs using this class may require changes with a new version of VirtualLab.
Class for writing text to a file in an optimized way. A buffer is used to reduce file accesses, which speeds up the text writing.

Constructor & Destructor Documentation

◆ TextWriterFileHandler()

TextWriterFileHandler ( string  fileName,
string  headerInformation = "" 
)

Standard constructor.

Parameters
fileNameThe name of the file to which text shall be written.
headerInformationOptional header information which shall be written in the text file.

Member Function Documentation

◆ Write()

void Write ( string  lineString)

Method to write a string to the file specified in the constructor. If you want to write multiple lines at once, you can also use this method and separate the lines with "\r\n".

Parameters
lineStringThe string to write.

◆ WriteLine()

void WriteLine ( string  lineString)

Method to write a complete line to the file specified in the constructor.

Parameters
lineStringThe string to write.