Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

DoFlush abstract method

Project: I/O Utility Classes

Unit: PJPipeFilters

Class: TPJPipeFilter

Applies to: ~>1.0

procedure DoFlush; virtual; abstract;

Description

Flushes any valid unprocessed data from any internal buffers.

Not all filters necessarily have any valid buffered data. If this is the case they need only provide a stub, do nothing, implementation of this method.

Those filters that can have such data must take the necessary steps to process it here.

Example

Both TPJUnicodeBMPPipeFilter and TPJAnsiSBCSPipeFilter split processed text into lines and report each line via their OnLineEnd events.

Often there will be some text left over after the last end of line that has not been reported. Both classes implement this method to report that remaining text via the OnLineEnd event as if the text was terminated by the normal end-of-line marker.

Here is the code from TPJUnicodeBMPPipeFilter:

procedure TPJUnicodeBMPPipeFilter.DoFlush;
begin
  if fPartialLine <> '' then
  begin
    DoLineEnd(fPartialLine);
    fPartialLine := '';
  end;
end;

fPartialLine stores text that is yet to be reported via the OnLineEnd event and DoLineEnd triggers the OnLineEnd event.