Show/Hide Toolbars

RiverSoftAVG Products Help

The IStreamable interface defines an abstract interface for an object that saved to a stream and retrieved back from a stream. The object may be saved to any TStream descendant. If the object also needs to be streamable by the Delphi Component (design-time) streaming system (TReader and TWriter objects instead of TStream), it should implement the CommonInterfaces.IDTStreamable interface instead.

noteNote

The objects that implement this interface should also call the RegisterClass method to register the object so that the Delphi FindClass method can find the class from its class name.

Namespace: CommonInterfaces

and read in the object:

Delphi

var
   L: Integer;
   Obj: TPersistent;
   TheClass: String;
   Streamable: IStreamable;
 begin
   L := 0;
   Stream.Read(L, SizeOf(Integer));
   SetString(TheClass, PChar(nil), L);
   Read(Pointer(TheClass)^, L);
   Obj := FindClass( TheClass ).Create;
   if Obj.GetInterface( IStreamable, Streamable ) then
     Streamable.ReadData( Stream );
 end; 

RiverSoftAVG Products Help © 1996-2016 Thomas G. Grubb