[Overview][Resource strings][Constants][Types][Classes][Index] |
The raw resource data stream
Source position: resource.pp line 176
public property TAbstractResource.RawData : TStream |
This property provides access to the resource raw data in a stream-like way.
When a resource has been read from a stream, RawData redirects read operations to the original stream. When RawData is written to, a copy-on-write mechanism copies data from the original stream to a memory stream.
The copy-on-write behaviour can be controlled via CacheData property.
Note that for some predefined resource types there are better ways to read and write resource data: some resource types use specific formats, so RawData might not always be what one expected. E.g. in a resource of type RT_BITMAP, RawData doesn't contain a valid BMP file: in this case it's better to use BitmapData stream of TBitmapResource class to work with a BMP-like stream.
Remark: | When writing to a "specialized" stream in a descendant class (like the TBitmapResource.BitmapData stream mentioned earlier), RawData contents might not be valid anymore. If you need to access RawData again, be sure to call UpdateRawData method first. |
Usually there isn't much penalty in using specialized streams in descendant classes, since data isn't duplicated in two or more streams, whenever possible. So, having a very large bitmap resource and reading/writing it via TBitmapResource.BitmapData doesn't mean the bitmap is allocated two times.
|
Controls the copy-on-write behaviour of the resource |
|
|
Updates RawData stream. |
|
|
Sets a custom stream as the underlying stream for RawData |