Use these methods in your class. loadStonFromFile: aDataFilenameString | data | data := STON fromStream: ((self dataFileNamed: aFilenameString) readStream). ^data persistAsSton: anObject toFile: aDataFilenameString (self newDataFileNamed: aFilenameString) writeStreamDo: [ :out | out << (STON toString: anObject) ] dataFileNamed: filename "For an existing file" ^ (FileLocator imageDirectory / 'data' / filename) fullPath asFileReference newDataFileNamed: filename | file | file := (FileLocator imageDirectory / 'data' / filename ) fullPath asFileReference. file writeStream close. ^ file Usage: "Saving" self persistAsSton: someDataStructure toFile: self newDataFileNamed: 'persist.dat' "Loading" someDataStructure := self loadStonFromFile: self dataFileNamed: 'persist:dat' HTH Phil On Wed, Nov 2, 2016 at 3:38 PM, Sven Van Caekenberghe <sven@stfx.eu> wrote:
On 2 Nov 2016, at 15:29, sergio ruiz <sergio.rrd@gmail.com> wrote:
Hmm⦠i need to look at this ..
i can just burp out all my objects with ston and suck them back in on the local machine..
Just try it ;-)
STON put: myObjects onStream[Pretty]: fileStream.
STON fromStream: fileStream.
https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/ lastSuccessfulBuild/artifact/book-result/STON/STON.html
STON has already seen quite some usage, so you should be good.
On November 2, 2016 at 10:25:51 AM, phil@highoctane.be ( phil@highoctane.be) wrote:
Keeping data in image with a STON export would be good enough:
peace, sergio photographer, journalist, visionary
Public Key: http://bit.ly/29z9fG0 #BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV http://www.Village-Buzz.com http://www.ThoseOptimizeGuys.com http://www.coffee-black.com http://www.painlessfrugality.com http://www.twitter.com/sergio_101 http://www.facebook.com/sergio101