### Data Streams

You get an IDataStream object when you create a stream. This object handles the encoding of data onto the stream, the decoding of data off of the stream, and the buffering and physical IO of the stream data. IDataStream is not intended to be subclassed, instantiated directly, or copied. Data streams are created using stream creation functions from other classes (for example, IFile::createStream).

You can write objects to streams in any order you choose, so long as you read corresponding objects in the same order.

You must know the type of an object that has been written to a stream in order to read it from the stream. When you stream in an object pointer, you must stream into a pointer that is the same type as the object on the stream or one of the object's base classes.

If you write an object monomorphically, you must read it monomorphically. If you write an object polymorphically, you must read it polymorphically. Monomorphic streaming writes out only the bits that represent the value of the streamed object, while polymorphic streaming writes out object information in addition to the object's value.

Introduction to the Streaming Classes
Monomorphic Streaming
Polymorphic Streaming

Instantiating a Data Stream
Streaming Aliases and Aliased Objects
Streaming Objects Monomorphically
Streaming Objects Polymorphically