System.Classes.TReader

From Appmethod Libraries
Jump to: navigation, search

System.Classes.TFilerSystem.TObjectTReader

Object Pascal

TReader = class(TFiler)

C++

class PASCALIMPLEMENTATION TReader : public TFiler

Properties

Type Visibility Source Unit Parent
class public
System.Classes.pas
System.Classes.hpp
System.Classes System.Classes

Description

TReader is a specialized filer that reads component data from an associated stream.

TReader is used internally by the component streaming system to restore the state of a component that has been written to a stream. It handles the mechanics of reading the data associated with a component from the stream. The reader object, rather than the stream object, is responsible for handling the complexities of streaming components. These include methods for:

  • Creating component instances from class names read from the stream.
  • Assigning stream data to published component properties.
  • Enabling an object to store hidden or complex data as if they were published properties of the object.
  • Resolving references between components, such as when a property refers to another component.

Other methods and properties of TReader trigger the reader object's events and interaction with the stream.

Applications do not directly create reader objects. Readers are automatically created in a stream object's methods or in global routines that initiate the component streaming process. These include:

  • The global ObjectBinaryToText procedure, which directly creates a reader object.
  • The global ReadComponentResFile function, which creates a file stream that creates a reader object.
  • The ReadComponent method of a stream object, which creates a reader object.

Once the streaming process is underway, applications do not need to directly manipulate reader objects. The interaction between the reader, component, and stream objects happens automatically in methods of these objects that make calls to each other.

See Also

Code Examples