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

# TReader

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

Generic reader object which reads component data from any given source.

## Declaration

`type TReader = class(TFiler)`
`protected`
`function Error(); virtual;` |  | Calls an installed error handler and passes it Message
`function FindMethod(); virtual;` |  | Return the address of a published method.
`procedure ReadProperty();` |  | Read and process a property name
`procedure ReadPropValue();` |  | Reads a property value for PropInfo.
`procedure PropertyError;` |  | Skips a property value and raises an exception.
`procedure ReadData();` |  | Reads the components data after it has been created.
`property PropName: String; [r]` |  | Name of the property being read at this moment.
`property CanHandleExceptions: Boolean; [r]` |  | Indicates whether the reader is handling exceptions at this stage.
`public`
`constructor Create();` |  | Creates a new reader class
`destructor Destroy; override;` |  | Destroys a reader class.
`procedure BeginReferences;` |  | Initializes the component referencing mechanism.
`procedure CheckValue();` |  | Raises an exception if the next value in the stream is not of type Value
`procedure DefineProperty(); override;` |  | Reads a user-defined property from the stream.
`procedure DefineBinaryProperty(); override;` |  | Reads a user-defined binary property from the stream.
`function EndOfList;` |  | Returns true if the stream contains an end-of-list marker.
`procedure EndReferences;` |  | Finalizes the component referencing mechanism.
`procedure FixupReferences;` |  | Tries to resolve all unresolved component references.
`function NextValue;` |  | Returns the type of the next value.
`function ReadBoolean;` |  | Reads a boolean from the stream.
`function ReadChar;` |  | Reads a character from the stream.
`procedure ReadCollection();` |  | Reads a collection from the stream.
`function ReadComponent();` |  | Starts reading a component from the stream.
`procedure ReadComponents();` |  | Starts reading child components from the stream.
`function ReadFloat;` |  | Reads a float from the stream.
`function ReadSingle;` |  | Reads a single-type real from the stream.
`function ReadDate;` |  | Reads a date from the stream
`function ReadIdent;` |  | Reads an identifier from the stream.
`function ReadInteger;` |  | Reads an integer from the stream
`function ReadInt64;` |  | Reads a 64-bit integer from the stream.
`procedure ReadListBegin;` |  | Checks for the beginning of a list.
`procedure ReadListEnd;` |  | Checks for the end of a list.
`function ReadRootComponent();` |  | Starts reading a root component.
`function ReadString;` |  | Reads a string from the stream.
`function ReadValue;` |  | Reads the next value type from the stream.
`procedure CopyValue();` |  | Copy a value to a writer.
`property Driver: TAbstractObjectReader; [r]` |  | The driver in use for streaming the data.
`property Owner: TComponent; [rw]` |  | Owner of the component being read
`property Parent: TComponent; [rw]` |  | Parent of the component being read.
`property OnError: TReaderError; [rw]` |  | Handler called when an error occurs.
`property OnFindMethod: TFindMethodEvent; [rw]` |  | Handler to find or change a method address.
`property OnSetName: TSetNameEvent; [rw]` |  | Handler called when setting a component name.
`property OnReferenceName: TReferenceNameEvent; [rw]` |  | Handler called when another component is referenced.
`property OnAncestorNotFound: TAncestorNotFoundEvent; [rw]` |  | Handler called when the ancestor component cannot be found.
`property OnCreateComponent: TCreateComponentEvent; [rw]` |  | Handler called when a component needs to be created.
`property OnFindComponentClass: TFindComponentClassEvent; [rw]` |  | Handler called when a component class reference needs to be found.
`end;`

## Inheritance

`TReader` |  | Generic reader object which reads component data from any given source.
`TFiler` |  | Class responsible for streaming of components.
`TObject`

## Description

The TReader class is a reader class that implements generic component streaming capabilities, independent of the format of the data in the stream. It uses a driver class TAbstractObjectReader to do the actual reading of data. The interface of the TReader class should be identical to the interface in Delphi.

## See also

TFiler |  | Class responsible for streaming of components.
TWriter |  | Object to write component data to an arbitrary format.
TAbstractObjectReader |  | Abstract driver class to read stored component data.