Skip to content

TFileReader.Create

Create a new instance of TFileReader for a disk file.

Declaration

Source position: streamex.pp line 159

public 
constructor Create(const AFileName: TFileName; AMode: Word; 
                  ARights: Cardinal; ABufferSize: Integer);  virtual;

constructor Create(const AFileName: TFileName; AMode: Word; 
                  ABufferSize: Integer);  virtual;

constructor Create(const AFileName: TFileName; ABufferSize: Integer)
                  ;  virtual;

constructor Create(const AFileName: TFileName);  virtual;

Description

Create initializes a TFileReader using the provided AFileName. 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.

The AMode can be used to specify the mode in which to open the file. This is one of the fmOpenRead and fmShare* constants which can be used in a TFileStream constructor. The file must be opened for reading.

Errors

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

See also

Name Description
TStreamReader.Destroy Destroy the TStreamReader instance.
TFileStream
TFileStream.Create