|
|
6.106 ObjectDumper
- Defined in namespace Smalltalk
- Category: Streams-Files
- I'm not part of a normal Smalltalk system, but most
Smalltalks provide a similar feature: that is, support for storing objects
in a binary format; there are many advantages in using me instead of #storeOn:
and the Smalltalk compiler.
The data is stored in a very compact format, which has the side effect of
making loading much faster when compared with compiling the Smalltalk code
prepared by #storeOn:. In addition, my instances support circular references
between objects, while #storeOn: supports it only if you know of such
references at design time and you override #storeOn: to deal with them
6.106.1 ObjectDumper class: establishing proxy classes
- disableProxyFor: aClass
- Disable proxies for instances of aClass and its descendants
- hasProxyFor: aClass
- Answer whether a proxy class has been registered for instances of aClass.
- proxyClassFor: anObject
- Answer the class of a valid proxy for an object, or nil if none could be found
- proxyFor: anObject
- Answer a valid proxy for an object, or the object itself if none could be found
- registerProxyClass: aProxyClass for: aClass
- Register the proxy class aProxyClass - descendent of DumperProxy - to be used for instances of aClass and its descendants
6.106.2 ObjectDumper class: instance creation
- new
- This method should not be called for instances of this class.
- on: aFileStream
- Answer an ObjectDumper working on aFileStream.
6.106.3 ObjectDumper class: shortcuts
- dump: anObject to: aFileStream
- Dump anObject to aFileStream. Answer anObject
- loadFrom: aFileStream
- Load an object from aFileStream and answer it
6.106.4 ObjectDumper class: testing
- example
- This is a real torture test: it outputs recursive objects, identical objects multiple times, classes, metaclasses, integers, characters and proxies (which is also a test of more complex objects)!
6.106.5 ObjectDumper: accessing
- flush
- `Forget' any information on previously stored objects.
- stream
- Answer the ByteStream to which the ObjectDumper will write and from which it will read.
- stream: aByteStream
- Set the ByteStream to which the ObjectDumper will write and from which it will read.
6.106.6 ObjectDumper: loading/dumping objects
- dump: anObject
- Dump anObject on the stream associated with the receiver. Answer anObject
- load
- Load an object from the stream associated with the receiver and answer it
6.106.7 ObjectDumper: stream interface
- atEnd
- Answer whether the underlying stream is at EOF
- next
- Load an object from the underlying stream
- nextPut: anObject
- Store an object on the underlying stream
|