[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Graphics' (#lcl)

# TCustomIcon.ReadData

Reads data for the class instance from a stream.

## Declaration

Source position: graphics.pp line 1639

`protected procedure TCustomIcon.ReadData(`
`Stream: TStream`
`); override;`

## Description

ReadData is an overridden method used to read the data for the class instance from the TStream instance specified in Stream. ReadData is the method called when TFiler reads a persistent object during LCL component streaming.

ReadData saves the position in Stream on entry, and restores the original position prior to exiting from the method.

ReadData checks the values in Stream to determine if a size prefix for the content is stored in the stream. Delphi streaming does not include the size prefix. Current Lazarus versions do. When the LongInt value used as the StreamSignature is 0, the LoadFromStream method is called to load the contents of the stream. Otherwise, the inherited method is called to complete the operation.

ReadData is also called from the LoadFromResourceHandle method in TIcon.

## See also

TRasterImage.ReadData |  | Reads image data during component streaming.
TGraphic.ReadData |  | ReadData - reads data for the Graphic from a stream.
TIcon.LoadFromResourceHandle |  | Loads icon data from the specified instance and resource handles.
TFiler