Class TBufferedInputStream (unit SuperStream)

Inherits from

TStreamAdapter

The buffered input stream adapter can accelerate the use of underlying streams. Delphi's TFileStream performs no buffering, so its performance when reading and writing large numbers of small objects is not very good. Wrapping a TFileStream with a TBufferedStream results in much better performance. Note that you can only read from these streams. Writing will throw an exception.

Constructors


constructor Create(targetStream : TStream; bufSize : Integer; Owned : Boolean);



Functions

destructor Destroy; override;

Destroy a stream adapter.

function Read(var Buffer; Count: Longint): Longint; override;

Read count bytes into buffer.

function Seek(Offset: Longint; Origin: Word): Longint; override;

Move to a given position in the stream.

function Write(const Buffer; Count: Longint): Longint; override;

write count bytes to the stream.

Properties

property BufferSize : Integer


Events

Variables


Constructors


constructor Create(targetStream : TStream; bufSize : Integer; Owned : Boolean);


Functions


destructor Destroy; override;

Destroy a stream adapter. Will also destroy the target stream if the owned flag is set true.


function Read(var Buffer; Count: Longint): Longint; override;

ParameterDescription
bufferVariable to read bytes into.
countNumber of bytes to read.

Read count bytes into buffer. This is an override of the standard stream function.


function Seek(Offset: Longint; Origin: Word): Longint; override;

ParameterDescription
offsetThe position to move to.
originWhere to move: Can be soFromBeginning, soFromCurrent, or soFromEnd.

Move to a given position in the stream.


function Write(const Buffer; Count: Longint): Longint; override;

ParameterDescription
bufferVariable to write to the stream.
countNumber of bytes to write.

write count bytes to the stream. This is an override of the standard stream function.


Properties


property BufferSize : Integer


Events


Variables