Instantiating a Data Stream

The constructors for the IDataStream class are private and intended only for internal use. You have two alternatives:

You will typically use a memory stream in a test program to verify the operation of the streaming functions of other classes. You create the stream, write to it, reset it and then read from it. The backing memory grows as necessary to hold the data. When you instantiate a memory stream, you can supply an optional stream format encoding. The default is IDataStream::kInteroperableBinary.

To instantiate a memory stream with the default encoding, kInteroperableBinary, use the following code:

IDataStream* memoryStream = IDataStream::createMemoryStream();

To use specify a stream format encoding, pass the appropriate enumerated value to the createMemoryStream function:

IDataStream* memoryStream = IDataStream::createMemoryStream(IDataStream::kRawBinary);
IDataStream* memoryStream = IDataStream::createMemoryStream(IDataStream::kInteroperableBinary);
IDataStream* memoryStream = IDataStream::createMemoryStream(IDataStream::kDebug);


Introduction to the Streaming Classes
Exceptions Defined by the Streaming Classes
Data Streams
Release-to-Release Data Compatibility (RRDC)


Adding Streaming Support to Structs and Simple Classes
Creating a Streamable Class
Creating a Streamable Template Class
Instantiating a Stream Module
Enabling Release-to-Release Data Compatibility
Streaming Base Classes
Streaming Aliases and Aliased Objects
Streaming Objects Monomorphically
Streaming Objects Polymorphically
Transitioning from Older Streaming Constructs