Symbian
Symbian OS Library

FAQ-0600 How do I save and restore stream data to descriptors?

[Index][spacer] [Previous] [Next]



 

Classification: C++ Category: Streams & Stores
Created: 07/02/97 Modified: 07/10/2001
Number: FAQ-0600
Platform: ER5, Symbian OS v6.0, Symbian OS v6.1

Question:
Sometimes we need to use the ExternalizeL and InternalizeL functions to save and restore the internal state of an
object, but we want to store the results only in memory. Or perhaps we need to copy the results across a client-server
boundary (which requires data in the form of a descriptor). How do we do this?


Answer:

The class RBufWriteStream allows ExternalizeL functions to write to memory.

It can be constructed using a CBufFlat object, a flat buffer which automatically reallocates itself as required. Once the stream is filled, we can get the contents as a TPtr8 by calling Ptr(0) on this CBufFlat object.

To pass data in a descriptor to InternalizeL functions, use RDesReadStream, which takes a descriptor in its constructor.