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

# TFileReader.Create

Create a new instance of TFileReader for a disk file

## Declaration

Source position: streamex.pp line 149

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

## Arguments

`AFileName` |  | Filename of file to open
`AMode` |  | Mode in which to open the file
`ARights` |  | Not used
`ABufferSize` |  | Size of buffer to use when reading.

## Arguments

`AFileName` |  | Filename of file to open
`AMode` |  | Mode in which to open the file
`ABufferSize` |  | Size of buffer to use when reading.

## Arguments

`AFileName` |  | Filename of file to open
`ABufferSize` |  | Size of buffer to use when reading.

## Arguments

`AFileName` |  | Filename of file to open

## 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

TStreamReader.Destroy |  | Destroy the TStreamReader instance.
TFileStream
TFileStream.Create

Documentation generated on: May 14 2021