Navigation:  Programming Cookbook > Binary Filing Objects >

Customising storage

Previous pageReturn to chapter overviewNext page

Sometimes it is necessary to perform some special action on an object as it is being read from an STB data stream. For instance, a Symbol object cannot just be constructed from the data, Smalltalk must be made aware of its existence by 're-interning' it. Another example is a Collection subclass whose elements are hashed; they must be properly created with respect to their hash values or they will fail to work properly. If the object you are saving contains a reference to some object that must not be re-created, you may instead want to find the contemporary of the object in the target image on load.

In all of these cases you can achieve the required objective by using or creating a subclass of STBProxy. You simply store an instance of the proxy in place of the original object, the proxy contains sufficient methods and information to properly resolve itself back into the original object when re-loaded.