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

# TStreamReader.Create

Create a new instance of TStreamReader from a stream

## Declaration

Source position: streamex.pp line 114

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

## Arguments

`AStream` |  | Stream to use as source of text data.
`ABufferSize` |  | Buffer size to use for read buffer.
`AOwnsStream` |  | Should the stream be freed when the textreader is freed.

## Arguments

`AStream` |  | Stream to use as source of text data.

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

TStreamReader.Destroy |  | Destroy the TStreamReader instance.
TStream

Documentation generated on: May 14 2021