TAbstractResource.SetCustomRawDataStream procedure
Sets a custom stream as the underlying stream for RawData
Declaration
procedure SetCustomRawDataStream(aStream: TStream)Arguments
aStream | The custom stream to use as the underlying
RawData stream. It can be
|
Description
Normally, RawData uses a memory stream or the original resource stream (e.g. the original file containing the resource) as its underlying stream. This method allows the user to use a custom stream as the underlying stream. This can be useful when a resource must be created from the contents of an original file as-is.
If aStream is nil, a new memory stream is used as the underlying stream. This can be used to remove a previously set custom stream as the underlying stream.
Sample code
This code creates a resource containing an html file
var
aType, aName : TResourceDesc;
aRes : TGenericResource;
aFile : TFileStream;
begin
aType:=TResourceDesc.Create(RT_HTML);
aName:=TResourceDesc.Create('index');
aRes:=TGenericResource.Create(aType,aName);
aFile:=TFileStream.Create('index.html',fmOpenRead or fmShareDenyNone);
aRes.SetCustomRawDataStream(aFile);
//do something...
aRes.Free;
aFile.Free;
aType.Free;
aName.Free;
end;See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
