WriteFromStream(Stream: IIOStream);
Stream. The stream, from which data for write will be obtained.
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 UserProc;
Var
Mb: IMetabase;
CustomObject: IMetabaseCustomObject;
Writer: IMetabaseCustomObjectWriter;
Reader: IMetabaseCustomObjectReader;
Stream: IIOStream;
i: Integer;
Begin
Mb := MetabaseClass.Active;
CustomObject := Mb.ItemById("OBJ_CUSTOM").Edit 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");
(CustomObject As IMetabaseObject).Save;
End Sub UserProc;
After executing the example data from created stream are written and saved, then these data are downloaded in the file C:\Stream.txt.
See also: