Sign in Join
FPDoc Onlineexperiment

TCustomBufDataset.GetPacketReader function

Member of TCustomBufDatasetprotectedIn unit BufDataset

Gets a Data Packet Reader using the specified data format for the dataset.

Declaration

pascal
function GetPacketReader(const Format: TDataPacketFormat; 
 const AStream: TStream): TDataPacketReader
 ; virtual

Arguments

Format

Data packet format for the desired packet reader.

AStream

Stream with content to examine in the method.

Function result

Data packet reader for the specified format.

Description

GetPacketReader is a TDataPacketReader function used to get the data packet reader needed for the specified data packet format. Format is TDataPacketFormat enumeration value that indicates the format used when reading data packets. AStream is a TStream descendant with the values read using the data packet reader.

GetPacketReader checks for a TDataPacketReaderClass type which uses the specified data packet format. The class type is registered using the RegisterDatapacketReader procedure. If a match is found, the return value is set to the instantiated class type. If no match is found, the TFpcBinaryDatapacketReader class is used to examine the values in the AStream argument. If the data packets are in binary format, the class is instantiated and assigned as the return value for the method. An exception is raised if no data packet reader is found for the specified format.

GetPacketReader is used in the implementation of the LoadFromStream and IntLoadFieldDefsFromFile methods.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.