How do I handle buffered I/O on large files?
Also see Working with Buffered I/O
The way that ATagParser handles data via events is equivalent to a SAX style parser in many respects. ATagParser is unique in that it senses the end of the parsing operation and sets properties in the EndState object to reflect what it knows about the last operation before the parsing operation completes. This makes it a simple matter to parse across buffers.
The following functions reside in the Utility_Ex file in the \Common folder and are used for buffered IO from very large files and streams.
function ParseStreamBuffered(Stream: TStream; Parser: TATagParser): Integer;
function ParseFileBuffered(const FileName: String; Parser: TATagParser): Integer;
function ParseFileMapped(const FileName: String; Parser: TATagParser): Integer;
The ParseFileMapped function uses the Windows file mapping API, whereas the 2 buffered functions uses a 16k buffer to read from the file or stream.
Copyright 2000 - 2006 John E McTaggart - All rights reserved worldwide