Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Advanced Tools Module User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

5.3 Supported Streaming Formats

The form of a serialized object is controlled by the object stream. The Serialization package provides a compact format, either annotated or non-annotated, that provides a choice of representations for primitive data elements

An object stream recursively deconstructs an object graph into pieces of some primitive (built-in) C++ data type. The representation of the data depends on the object stream implementation. If you are using object serialization only to serialize objects and then recreate them with Serialization object streams, the intermediate format is completely transparent to your application. Your choice of formats depends only on considerations of size, speed, and portability. On the other hand, if you plan to do any explicit processing of the object stream contents, the format is an important consideration.

5.3.1 The Compact Object Stream Format

Compact object streams give you flexibility. When this kind of object stream is created, it is chained to a concrete data stream that, in turn, implements the input and output of primitive types. This means that the same object stream can be used to read or write data in many formats, such as ASCII and native binary, on many types of media, such as files, strings, and XDR. This format is not self-describing; it passes information about the object's state only. Compact object streams can interoperate with virtual streams and collectable objects.

5.3.1.1 Object Streams With Data Streams

Compact object streams work with any stream of type RWDataOutputStream or RWDataInputStream. You can choose a data stream from the Streams package, such as the RWDataToByteOutputStreamImp and RWDataToByteInputStreamImp classes. For the full selection of streams, see Section 3.5.5, "The Data Streams."

You can also use the data stream in the Serialization package, which is an adapter to the Essential Tools Module virtual streams.

5.3.1.2 Object Streams With Virtual Streams

Object streams work with virtual streams through adapters. If a serializable object needs to be saved or restored from a virtual stream, then an object stream can be constructed from the virtual stream using the RWDataFromVirtualInputStreamImp and RWDataToVirtualOutputStreamImp adapter classes. (See Section 6.2.2.5, "Writing to and Reading from Compact Object Streams With Virtual Streams.")

The adapter enables you to format the primitive types in any way virtual streams can:

5.3.1.3 Object Streams With Collectable Objects

Collectable objects can also be saved and restored to object streams using the adapter classes RWvistreamFromDataInputStream and RWvostreamToDataOutputStream in the Streams package. Operators are included to handle this process automatically. See Section 3.5.5.6 and Section 3.5.5.5 for instructions.


The Persistence facility in the Essential Tools Module and the Serialization package operate together and can be freely mixed in applications.



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.