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

# TDataPacketReader

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Implements a data packet reader for TBufDataset

## Declaration

Source position: bufdataset.pas line 359

`type TDataPacketReader = class(TObject)`
`FDataSet: TCustomBufDataset;`
`FStream: TStream;`
`public`
`constructor Create(); virtual;` |  | Constructor for the class instance
`procedure LoadFieldDefs(); virtual; abstract;` |  | Loads the field definitions for the dataset from a stream
`procedure InitLoadRecords; virtual; abstract;` |  | Called before the records are loaded
`function GetCurrentRecord; virtual; abstract;` |  | Returns True if there is at least one more record available in the stream
`function GetRecordRowState(); virtual; abstract;` |  | Returns the RowState of the current record, and the order of the update
`procedure RestoreRecord; virtual; abstract;` |  | Restores a record from the stream into the current record buffer
`procedure GotoNextRecord; virtual; abstract;` |  | Moves to the next record in the stream
`procedure StoreFieldDefs(); virtual; abstract;` |  | Saves field definitions to a stream
`procedure StoreRecord(); virtual; abstract;` |  | Saves the current record buffer to the stream
`procedure FinalizeStoreRecords; virtual; abstract;` |  | Called after all records are stored
`class function RecognizeStream(); virtual; abstract;` |  | Checks if the provided stream is of the right format for this class
`end;`

## Inheritance

`TDataPacketReader` |  | Implements a data packet reader for TBufDataset
`TObject`

## Description

TDataPacketReader is a TObject descendant which implements a data packet reader for TBufDataset. TDataPacketReader is a concept borrowed from TClientDatset in Delphi. Data packets are used to access the values in its dataset. Data packets can contain field definitions or record data. Data packets can store their values in binary format or as an XML document.

TDataPacketReader provides properties and methods that allow access to the field definitions, field values, and row states for record buffers in its dataset. Methods are provided to load and save field definitions or record data using a stream. Methods are provided to recognize the storage format for the data packets in the stream.

Many of the methods in TDataPacketReader are declared as virtual or abstract. They are implemented in descendent classes that use a specific data packet format, such as TFpcBinaryDatapacketReader or TXMLDatapacketReader (in xmldatapacketreader.pp).

## See also

TFpcBinaryDatapacketReader |  | Implements a data packet reader using binary data packets
TXMLDatapacketReader