The write stream interface

RWriteStream is an abstract class that presents the necessary interface for externalising to a stream. When called, the ExternalizeL() member function of a class is passed a reference to a concrete write stream object; for example, an object constructed from a class such as RStoreWriteStream . This allows ExternalizeL() to write the object's data to any stream, regardless of that stream’s concrete implementation.

All data types, including non-class types, can be externalised, although some can only be externalised using the templated stream operator<< .

RWriteStream provides support for externalizing:

  • TInt , TUint , TReal and TReal64 types.

  • The content of a descriptor.

  • The data from an open read stream object, a RReadStream type.

The WriteInt8() , WriteUint8() , WriteInt16() and WriteUint16() member functions allow applications to reduce the size of the stream when TInt and TUint values are guaranteed to be containable within 8 bits and 16 bits.

The write stream interface also allows data to be externalised from a location defined by a pointer and a length. However, this functionality is rarely used by application code.