Package Flatten :: Module Serialize
[show private | hide private]
[frames | no frames]

Module Flatten.Serialize

Serialize.py

Overview

Flatten is a library that is useful for serialization of network data. This module extends flatten by providing a set of functions (serialize/unserialize) which take a data object, process it by calling flatten on it, and returning a byte-stream. The corresponding call unserialize takes a serialized stream as created by serialize, and reconstructs the object(s) that are contained within.

The functionality of creating a byte-stream from a tuple/string structure is published under the names freeze/unfreeze, which return a string object or take one.

Flatten specialities

Flatten serializes the passed in data to a byte-stream which is basically an abstraction of a bracket language. There are tags and , which represent a bracket closing and opening, and several other special tags which represent content. As storage requirements play an important part when communicating over a network, the storage requirements are minimalized by switching between different representations of length bytes (8,16,32-bits), which are signaled in the stream by corresponding marker bytes.

Copyright

Flatten is copyright (C) 2002-3 by Heiko Wundram <heiko@asta.uni-saarland.de>.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library in the file "COPYLEFT"; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Function Summary
  asciiSerialize(data, *args, **kwargs)
Returns an ASCII representation of the data to serialize, which is 8-bit free (base64 coded).
  asciiUnserialize(data, *args, **kwargs)
Unserializes an ASCII representation of data which was serialized.
  freeze(data)
Takes a string/tuple structure as returned by the flatten function (but not solely from there), and returns a byte-stream for it.
  serialize(data, *args, **kwargs)
Serializes the passed in data to a byte-stream.
  unfreeze(data)
Takes a byte-stream as returned by the freeze function, and returns a string/tuple structure which is in a format returned by flatten, and readable by unflatten.
  unserialize(data, *args, **kwargs)
Unserializes the passed in data from a byte-stream.

Variable Summary
str __date__
str __version__

Function Details

asciiSerialize(data, *args, **kwargs)

Returns an ASCII representation of the data to serialize, which is 8-bit free (base64 coded). Otherwise works just like serialize().

asciiUnserialize(data, *args, **kwargs)

Unserializes an ASCII representation of data which was serialized. The data must be coded in base64. Otherwise works just like unserialize().

freeze(data)

Takes a string/tuple structure as returned by the flatten function (but not solely from there), and returns a byte-stream for it.

serialize(data, *args, **kwargs)

Serializes the passed in data to a byte-stream. The data is first flattened by calling the flatten function of the Flatten module, and then stored by calling the freeze function of this module.

unfreeze(data)

Takes a byte-stream as returned by the freeze function, and returns a string/tuple structure which is in a format returned by flatten, and readable by unflatten.

unserialize(data, *args, **kwargs)

Unserializes the passed in data from a byte-stream. The data is first unfrozen by calling the unfreeze function of this module, then unflattened by calling the unflatten function of the Flatten module.

Variable Details

__date__

Type:
str
Value:
'2003/08/17'                                                           

__version__

Type:
str
Value:
'0.2p3'                                                                

Generated by Epydoc 1.1 on Sun Aug 17 03:32:31 2003 http://epydoc.sf.net