WriteFromStream(Stream: IIOStream);
Stream - stream from that data are received for writing.
The WriteFromStream method writes data in an object from a stream.
Executing the example requires that the repository contains a custom class object with the OBJ_CUSTOM identifier. There also must be the file C:\Stream.txt.
Sub Main;
Var
Mb: IMetabase;
Object: IMetabaseObject;
CustomObject: IMetabaseCustomObject;
Writer: IMetabaseCustomObjectWriter;
Reader: IMetabaseCustomObjectReader;
Stream: IIOStream;
i: Integer;
Begin
Mb := MetabaseClass.Active;
Object := Mb.ItemById("OBJ_CUSTOM").Edit;
CustomObject := Object As IMetabaseCustomObject;
Stream := New MemoryStream.Create;
For i := 65 To 90 Do
Stream.WriteByte(i);
End For;
Stream.Position := 0;
Writer := CustomObject.CreateWriter;
Writer.WriteFromStream(Stream);
Writer.Save;
Reader := CustomObject.CreateReader;
Reader.Load;
Reader.ReadToFile("C:\Stream.txt");
Object.Save;
End Sub Main;
After executing this example data from created stream are written and saved, then these data are downloaded in the file C:\Stream.txt.
See also: