RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TReader Class

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

Pascal
TReader = class(TFiler);
C++
class TReader : public TFiler;

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. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!