class AkentiOutputStream

An AkentiOutputStream object is used to serialize all types of objects using a simple scheme to write the objects' string reprsentations.

Public Methods

[more] AkentiOutputStream (ostream& os)
Constructs this object given an ostream object specified by os.
[more]AkentiOutputStream& write (const char* ptr, int n)
[more]AkentiOutputStream& operator<< (char c)
Writes a char to the underlying output stream.
[more]AkentiOutputStream& operator<< (int n)
Writes an int to the underlying output stream.
[more]AkentiOutputStream& operator<< (bool b)
Writes a bool to the underlying output stream.
[more]AkentiOutputStream& operator<< (long l)
Writes a long to the underlying output stream.
[more]AkentiOutputStream& operator<< (double d)
Writes a double to the underlying output stream.
[more]AkentiOutputStream& operator<< (const string& s)
Writes a string to the underlying output stream.
[more]AkentiOutputStream& operator<< (const UtcTime& time)
Writes a UtcTime to the underlying output stream.
[more]AkentiOutputStream& operator<< (const URL& url)
Writes a URL to the underlying output stream.
[more]AkentiOutputStream& operator<< (const DistinguishedName& dn)
Writes a DistinguishedName to the underlying output stream.
[more]AkentiOutputStream& operator<< (const AkentiObject& obj)
Writes an AkentiObject to the underlying output stream.


Documentation

An AkentiOutputStream object is used to serialize all types of objects using a simple scheme to write the objects' string reprsentations. For standard C++ types such as int, long, char this class just wraps the ostream methods.

For string objects containing blank spaces those spaces are escaped by preceeding them by a back slash. Escaping the blank space allows the deserializing process to distinguish between blank spaces that are part of the object being deserialized and the blank spaces used as delimiters between elements. Only the object is written to the ostream by these methods. The delimiting blank space between the ojbects must be written by the caller of this class.

Note:

Blank spaces at the beginning and at the end of an object's representation are ignored. Those in the middle are escaped and if there is a sequence of blanks in the middle, only one is escaped and the others are ignored.

Example1:

"/C=US/CN=John Doe" will be written as "/C=US/CN=John\ Doe"

Example2:

Deserializing "Hello\ John Bye\ John" will result in two strings "Hello John" and "Bye John"

It is recommended to use an AkentiInputStream object to deserialize objects.

o AkentiOutputStream(ostream& os)
Constructs this object given an ostream object specified by os. Note that the AkentiOutputStream is only valid as long as the underlying ostream is valid.

Parameters:
os - ostream the underlying output stream

oAkentiOutputStream& write(const char* ptr, int n)

oAkentiOutputStream& operator<<(char c)
Writes a char to the underlying output stream.

Throws:
IOException if writing fails
Parameters:
c - char to be written
Returns:
this AkentiOutputStream for chaining
See Also:
IOException

oAkentiOutputStream& operator<<(int n)
Writes an int to the underlying output stream.

Throws:
IOException if writing fails
Parameters:
n - int to be written
Returns:
this AkentiOutputStream for chaining
See Also:
IOException

oAkentiOutputStream& operator<<(bool b)
Writes a bool to the underlying output stream.

Throws:
IOException if writing fails
Parameters:
b - bool to be written
Returns:
this AkentiOutputStream for chaining
See Also:
IOException

oAkentiOutputStream& operator<<(long l)
Writes a long to the underlying output stream.

Throws:
IOException if writing fails
Parameters:
l - long to be written
Returns:
this AkentiOutputStream for chaining
See Also:
IOException

oAkentiOutputStream& operator<<(double d)
Writes a double to the underlying output stream.

Throws:
IOException if writing fails
Parameters:
d - double to be written
Returns:
this AkentiOutputStream for chaining
See Also:
IOException

oAkentiOutputStream& operator<<(const string& s)
Writes a string to the underlying output stream.

Blank spaces at the beginning and at the end of the string are ignored. Blanks in the middle are escaped and if there is a sequence of blanks in the middle, only one is escaped and the others are ignored.

Examples:

"aa bb" => "aa\\ bb" " aa bb " => "aa\\ bb" "aa bb" => "aa\\ bb"

Throws:
IOException if writing fails
Parameters:
s - string to be written
Returns:
this AkentiOutputStream for chaining

oAkentiOutputStream& operator<<(const UtcTime& time)
Writes a UtcTime to the underlying output stream.

Throws:
IOException if writing fails
Parameters:
time - UtcTime to be written
Returns:
this AkentiOutputStream for chaining
See Also:
UtcTime for the external format that is used
IOException

oAkentiOutputStream& operator<<(const URL& url)
Writes a URL to the underlying output stream.

Throws:
IOException if writing fails
Parameters:
url - URL to be written
Returns:
this AkentiOutputStream for chaining
See Also:
URL for the external format that is used
IOException

oAkentiOutputStream& operator<<(const DistinguishedName& dn)
Writes a DistinguishedName to the underlying output stream.

Throws:
IOException if writing fails
Parameters:
dn - DistinguishedName to be written
Returns:
this AkentiOutputStream for chaining
See Also:
DistinguishedName for the external format that is used
IOException

oAkentiOutputStream& operator<<(const AkentiObject& obj)
Writes an AkentiObject to the underlying output stream. Calls the writeObject method on the object handing it the AkentiOutputStream.

Throws:
IOException if writing fails
Parameters:
obj - AkentiObject to be written
Returns:
this AkentiOutputStream for chaining
See Also:
AkentiObject
IOException


This class has no child classes.
Author:
Srilekha Mudumbai Abdelilah Essiari Xiang Sun
Version:
1.1 00/05/01
See Also:
AkentiInputStream

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.