[Overview][Types][Classes][Procedures and functions][Index] | Reference for unit 'BufDataset' (#fcl)

# TCustomBufDataset.LoadFromStream

Loads the dataset from the specified stream using the given data format

## Declaration

Source position: bufdataset.pas line 647

`public procedure TCustomBufDataset.LoadFromStream(`
`AStream: TStream;`
`Format: TDataPacketFormat = dfDefault`
`);`

## Arguments

`AStream` |  | Stream with values loaded into the dataset
`Format` |  | Format expected in the stream

## Description

LoadFromStream is a procedure used to load field definitions and record data for the dataset from the specified stream. LoadFromStream is an overloaded variant of the method defined in the ancestor class and includes a parameter for the desired data packet format.

AStream is a TStream descendant with the values to load in the dataset. Format indicates the expected format for data packets in the stream. It is a variable argument that can be modified when a packet reader is located for the stream.

LoadFromStream calls CheckBiDirectional to ensure that the UniDirectional property in the dataset is set to False. An exception is raised when UniDirectional contains True. Index creation requires navigating in a non-default record order that would not be supported in a uni-directional dataset.

LoadFromStream creates a temporary TDataPacketReader class instance using the value specified in the Format argument. Format is a variable argument and can be modified when SetDatasetPacket is used to examine the packet reader and its stream. Calling SetDatasetPacket sets in motion a relatively complicated sequence of events that eventually get the field definitions and record data loaded into the dataset. The journey starts with Open.

LoadFromStream is used in the implementation of the LoadFromFile method.

## See also

TCustomBufDataset.UniDirectional |  | Indicates if the dataset is for uni-directional navigation only
TCustomBufDataset.SetDatasetPacket |  | Retrieves and applies the data packet with the content for the dataset
TCustomBufDataset.LoadFromFile |  | Loads the dataset from the specified file using the given format
TDataset.Open |  | Activate the dataset: Fetch data into memory.
TDataPacketFormat |  | Indicates the format used for data packets in TBufDataset

Documentation generated on: May 14 2021