[Overview][Constants][Classes][Index] | Reference for unit 'bufstream' (#fcl)

# Reference for unit 'bufstream'

Implements Buffered streams

`uses`
`System,`
`Classes,`
`sysutils;`

## Overview

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.