ReadToStream(Stream: IIOStream);
Stream. A stream, to which data from the object will be read.
The ReadToStream method reads data from the custom class object and loads it to the specified stream.
Before executing the ReadToStream method, call the Load method to read data from the repository base to the current object in the PC memory.
Executing the example requires that the repository contains a custom class object with the OBJ_CUSTOM identifier.
Sub Main;
Var
Mb: IMetabase;
Object: IMetabaseObject;
CustomObject: IMetabaseCustomObject;
Reader: IMetabaseCustomObjectReader;
Stream: IIOStream;
i: Integer;
Begin
Mb := MetabaseClass.Active;
Object := Mb.ItemById("OBJ_CUSTOM").Edit;
CustomObject := Object As IMetabaseCustomObject;
Stream := New MemoryStream.Create;
Reader := CustomObject.CreateReader;
Reader.Load;
Reader.ReadToStream(Stream);
For i := 0 To Stream.Size - 1 Do
Debug.WriteLine(Stream.ReadByte);
End For;
Object.Save;
End Sub Main;
After executing this example data from an object are read in a stream. Stream content is displayed in the console window.
See also: