[Overview][Resource strings][Constants][Types][Classes][Index] Reference for unit 'resource' (#fcl-res)

TResources.LoadFromStream

Loads the contents of the object from a stream

Declaration

Source position: resource.pp line 267

public procedure TResources.LoadFromStream(

  aStream: TStream

); overload;

procedure TResources.LoadFromStream(

  aStream: TStream;

  aReader: TAbstractResourceReader

); overload;

Arguments

aStream

  

The stream to read from

Arguments

aStream

  

The stream to read from

aReader

  

The resource reader to use to read the stream

Description

This method clears the TResources object and loads its contents from the stream passed as parameter.

If a reader is specified, that reader is used. Otherwise, the stream is probed to find a suitable reader.

Remark: If CacheData is set to true, the stream will be used as the underlying stream of each resource RawData stream. This means that the stream must not be freed until all resources in the TResources object are freed: this happens when the TResources object is cleared or is loaded again from a different source. If you need to free the stream while there are still resources, disable the copy-on-write mechanism by setting CacheData property to false.

Errors

If no reader is passed and probing fails, an EResourceReaderNotFoundException exception is raised.

See also

TAbstractResourceReader

  

Base abstract resource reader class

TAbstractResource.RawData

  

The raw resource data stream

TAbstractResource.CacheData

  

Controls the copy-on-write behaviour of the resource

TResources.CacheData

  

Controls the copy-on-write behaviour of all resources

TResources.LoadFromFile

  

Loads the contents of the object from a file

TResources.Clear

  

Deletes all resources

TResources.FindReader

  

Searches for a suitable resource reader


Documentation generated on: Nov 16 2015