'From Squeak4.2alpha of 2 October 2011 [latest update: #11712] on 5 October 2011 at 5:43:55 am'!

!Object methodsFor: 'objects from disk' stamp: 'edc 10/5/2011 05:43:11.619'!
saveOnFileNamed: aString 
	"Ask the user for a filename and save myself on a
	ReferenceStream file. Writes out the version and class structure.
	The file is fileIn-able. UniClasses will be filed out.
	This save objects as .obj"
	| aFileName fileStream |
	aString isEmpty
		ifTrue: [^ self error: 'name is missing'].
	aFileName := aString , '.obj'.
	fileStream := ReferenceStream fileNamed: aFileName .
	fileStream nextPut: self.
	fileStream close.
	! !


!Object class methodsFor: '*services-extras' stamp: 'edc 2/14/2008 08:24'!
fileReaderServicesForFile: fullName suffix: suffix
	| services |
	services := OrderedCollection new.
	
	(fullName asLowercase endsWith: '.obj')
		ifTrue: [ services add: self serviceLoadObject ].
	^services! !

!Object class methodsFor: '*services-extras' stamp: 'edc 2/14/2008 08:26'!
serviceLoadObject
"Answer a service for opening a saved Object"

	^ (SimpleServiceEntry 
		provider: self 
		label: 'saved Object'
		selector: #readAndInspect:
		description: 'open a Object'
		buttonLabel: 'object')
		argumentGetter: [:fileList | fileList readOnlyStream]! !

!Object class methodsFor: 'objects from disk' stamp: 'edc 7/1/2011 10:17'!
readAndInspect: inputStream
| o rr |
	rr := ReferenceStream on: inputStream.
	o := rr next.
	rr close.
	o inspect! ! !

