Skip to content

TBufferedFileStream.Flush

Flushes modified pages in the buffer to the file stream.

Declaration

Source position: bufstream.pp line 142

public 
procedure TBufferedFileStream.Flush;

Description

Flush is used to store modified pages in the internal buffer to the file stream. Flush examines the pages in the buffer to determine if any have been modified using Write.

When a "dirty" page is found, the inherited Seek method is called to position the stream to the location for the modified page. The inherited Write method is called to store content in the modified page buffer to the stream, and the modified flag for the buffer page is reset.

Buffer pages which not been modified are not (re-)written to the file stream.

Errors

Flush raises an EStreamError exception with the message in SErrCacheUnableToWriteExpected when the number of bytes written for a page does not match the allocated size for the page.

See also

Name Description
TBufferedFileStream.Write Writes the specified number of bytes in Buffer to the internal page buffer(s).
THandleStream.Seek
THandleStream.Write
TStream.Seek
TStream.Write
EStreamError