links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Ma Serializer
Last updated at 9:23 am UTC on 3 April 2017
The purpose of a Serializer is to convert domain objects to a String or ByteArray, and back. This representation of an object allows it to be stored on disk or sent over a networks, whereupon it can be converted back to an object for live processing by an application.

Ma Serializer is a serializer for Squeak which:


It can be installed from the SqueakMap UI, or via this Smalltalk code script:
	Installer new merge: #maInstaller.
	(Smalltalk classNamed: #MaInstaller) new merge: #serializerTests

Note:Loading Ma Serilalizer is currently included in the Ma "Base" layer which also has some extra classes and methods used by multiple applications, but not used or needed by Ma Serializer itself. These can be unloaded or, if there is interest, put exclusively into their own package.

Simplest Use, Save/Load an Object from the filesystem

To save an object to a file:
        	fileOut: myObject
        	toFileNamed: theFilename
        	in: theFileDirectory

To load an object from a file:
	MaObjectSerializer fileIn:

Effective Serialization

A serializer is useful to the extent it allows state to be seamlessly transferred between Smalltalk images. Any object which might be serialized is of a particular class. It may have references to objects which are outside the purview of its domain, such as the Transcript, or Smalltalk, or the current World. For these kinds of objects it must establish, and then restore, to the proper references in the target image, not create duplicate Smalltalk, Transcript or World objects. Ma Serializer handles this automatically.