ThFileStream
Provides file-based stream functionality by enabling reading from and writing to files on disk using a stream interface.Encapsulates file handling logic such as opening, closing, reading, writing, seeking, and resizing files, while maintaining compatibility with the ThStream abstract interface.
Supports standard stream operations and allows file manipulation with position and size control.
Public Procedures and Functions:
Read
Reads up to Count bytes from the file into the specified Buffer.The operation starts at the current file position and advances the position by the number of bytes read.
function Read(var Buffer; Count: Cardinal): Cardinal; override;
Parameters
- Buffer: var (untyped); Memory location to store the data read from the file.
- Count: Cardinal; The maximum number of bytes to read from the file.
Return Value
Returns the number of bytes actually read from the file.Write
Writes up to Count bytes from the specified Buffer to the file.The operation starts at the current file position and advances the position by the number of bytes written.
function Write(const Buffer; Count: Cardinal): Cardinal; override;
Parameters
- Buffer: const (untyped); The data to be written into the file.
- Count: Cardinal; The maximum number of bytes to write to the file.