Parse(Value: String);
Value - value that should be put into a stream.
The Parse method puts data, that was received by the ToString method and passed by the Value parameter, into a stream.
Sub Main;
Var
File1: IFileInfo;
BinR: IBinaryReader;
MStream, MStream1: IMemoryStream;
i: Integer;
Begin
MStream:=New MemoryStream.Create;
MStream1:=New MemoryStream.Create;
File1:=New FileInfo.Attach("c:\New_folder\1.dat");
If File1.Exists Then
BinR:=File1.OpenBinaryReader;
For i:=0 To File1.Size-1 Do
MStream.WriteByte(BinR.Stream.ReadByte);
End For;
MStream1.Parse(MStream.ToString);
End If;
Dispose File1;
Dispose MStream;
Dispose MStream1;
End Sub Main;
After executing this example, content of the file 1.dat is read into the stream MStream that is in memory. The stream MStream1 contains a copy of the stream MStream.
See also: