Parse(Value: String);
Value - value that must be placed into a stream.
The Parse method places data that was obtained 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 the example the contents of the 1.dat file is read into the MStream stream that is in memory. The MStream1 stream contains a copy of the MStream stream.
See also: