IMetabaseCustomObjectReader.ReadToStream

Syntax

ReadToStream(Stream: IIOStream);

Parameters

Stream. A stream, to which data from the object will be read.

Description

The ReadToStream method reads data from the custom class object and loads it to the specified stream.

Comments

Before executing the ReadToStream method, call the Load method to read data from the repository base to the current object in the PC memory.

Example

Executing the example requires that the repository contains a custom class object with the OBJ_CUSTOM identifier.

Sub UserProc;
Var
    Mb: IMetabase;
    CustomObject: IMetabaseCustomObject;
    Reader: IMetabaseCustomObjectReader;
    Stream: IIOStream;
    i: Integer;
Begin
    Mb := MetabaseClass.Active;
    CustomObject := Mb.ItemById("OBJ_CUSTOM").Edit 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;
End Sub UserProc;

After executing the example data from an object are read in a stream. Stream content is displayed in the console window.

See also:

IMetabaseCustomObjectReader