WriteStream fileOutClass: extraClass andObject: theObject
Last updated at 11:44 am UTC on 12 January 2019
- This method of a WriteStream object stores the object given as parameter.
- The code of an extraClass may be included (extraClass may also be nil)
- It is done with the help of SmartRefStream.
fileOutClass: extraClass andObject: theObject
"Write a file that has both the source code for the named class and an object as bits. Any instance-specific object will get its class written automatically."
| class srefStream |
"Type and Creator not to be text, so can attach correctly to an email msg"
self header; timeStamp.
extraClass ifNotNil: [
class := extraClass. "A specific class the user wants written"
class sharedPools size > 0 ifTrue:
ifTrue: [class fileOutSharedPoolsOn: self]].
class fileOutOn: self moveSource: false toFile: 0].
self trailer. "Does nothing for normal files. HTML streams will have trouble with object data"
"Append the object's raw data"
srefStream := SmartRefStream on: self.
srefStream nextPut: theObject. "and all subobjects"
srefStream close. "also closes me"