Skip to content

TAbstractResourceReader.Load

Loads resources from a stream

Declaration

Source position: resource.pp line 303

protected 
procedure TAbstractResourceReader.Load(aResources: TResources; 
                                      aStream: TStream);  virtual
                                      ;  abstract;

Description

A TResources object invokes this method when it needs to be loaded from a stream, passing itself as the aResources parameter and the stream as the aStream parameter.

aStream position is already correctly set: the reader must start to read from there.

Descendant classes must ensure that the the stream is in a format they recognize, otherwise an EResourceReaderWrongFormatException exception must be raised.

Each resource is then created, read from the stream and added to the TResources object.

When reading a resource, a reader must:

Errors

If the stream is in a format not recognized by the reader, a EResourceReaderWrongFormatException exception must be raised.

If the stream ends prematurely, a EResourceReaderUnexpectedEndOfStreamException exception must be raised.

See also

Name Description
TResources A collection of resources
TResources.LoadFromStream Loads the contents of the object from a stream
TResources.LoadFromFile Loads the contents of the object from a file
TAbstractResource Base abstract resource class
TAbstractResource.DataSize The size of resource raw data
TAbstractResource.DataOffset The offset of resource data from the beginning of the stream
TAbstractResource.RawData The raw resource data stream
TAbstractResourceReader.SetDataSize Protected method to let a reader set a resource DataSize property
TAbstractResourceReader.SetDataOffset Protected method to let a reader set a resource DataOffset property
TAbstractResourceReader.SetRawData Protected method to let a reader set a resource RawData property
TAbstractResourceReader.CheckMagic Checks whether a stream is in a format the reader recognizes
TResourceDataStream Stream class that provides copy-on-write functionality