Streams abstract the external storage of data (typically objects).
The Streaming API is abstract. It defines interfaces for reading and writing data to and from storage, but not what that storage is. Derived classes in other APIs provide particular implementations of streams:
The API has two key concepts: stream, and stream operators.
A stream is a representation of an object as a sequence of bytes. Streams are accessed by means of write streams, which allow data to be written to them, and read streams, which allow data to be read.
Data written to a stream should be in an external format: i.e. not depend on machine-specific properties such as endianness and padding. C++ classes designed to work with streams implement a function to externalise their state, and similarly an internalise function to set their state from a stream. The convention is to call these functions ExternalizeL() and InternalizeL() respectively.
The stream operators define (using templates) << and >> so that objects can be written to streams using the format astream << anobject astream << anobject, and internalised using astream >> anobject . These translate into calls to the object's ExternalizeL() and InternalizeL() functions respectively. The operators are also defined so that they can be used with basic types such as TInt8 , TReal32 , etc.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License v1.0.