Sign in Join
FPDoc Onlineexperiment

BufStream unit

Implements Buffered streams.

BufStream implements buffered streams. The streams store all data from (or for) the source stream in a memory buffer, and only flush the buffer when it's full (or refill it when it's empty).

Buffered streams can help in speeding up read or write operations, especially when a lot of small read/write operations are done. They avoid doing a lot of operating system calls.

TReadBufStream is used for reading only, and allows the buffer size to be specified at the time of creation.

TWriteBufStream is used for writing only, and allows the buffer size to be specified at the time of creation.

TBufferedFileStream can be used for reading and writing depending on the file mode specified at the time of creation. By default, it uses an internal buffer with 8 pages using a 4,096 byte page size. Both page count and page size are configurable using methods in the class.

Classes and records

TBufferedFileStreamclassImplements a buffered file stream with a multi-page buffer.
TBufStreamclassCommon ancestor for buffered streams.
TReadBufStreamclassRead-only buffered stream.
TWriteBufStreamclassWrite-only buffered stream.

Constants

DefaultBufferCapacityconstantDefault buffer size.

Uses

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.