Skip to content

TStreamReader.Create

Create a new instance of TStreamReader from a stream.

Declaration

Source position: streamex.pp line 122

public 
constructor Create(AStream: TStream; ABufferSize: Integer; 
                  AOwnsStream: Boolean);  virtual;

constructor Create(AStream: TStream);  virtual;

constructor Create(const aFilename: string);

constructor Create(const aFilename: string; aDetectBOM: Boolean);

constructor Create(const aFilename: string; aEncoding: TEncoding; 
                  aDetectBOM: Boolean; aBufferSize: Integer);  overload; overload;

Description

Create initializes a TStreamReader using the provided AStream. It will allocate a buffer of ABufferSize bytes for faster reading of data. If no buffer size is specified, BUFFER_SIZE will be used. If the ABufferSize argument is less than MIN_BUFFER_SIZE, then MIN_BUFFER_SIZE bytes will be used.

If AOwnsStream is true, the stream will be freed when the TStreamReader instance is freed. If omitted, its value is assumed to be False.

Errors

If AStream is Nil, an #rtl.sysutils.EArgumentException exception will be raised.

See also

Name Description
TStreamReader.Destroy Destroy the TStreamReader instance.
TStream