Philippe, On 24 Apr 2012, at 22:20, Philippe Back wrote:
How to ship binary around?
It works ;-) But I must say that this is/was not my primary use case. I think that a binary format like Fuel is better (more efficient, better/deeper system integration). Anyway, here is an example: Here is the Pharo logo ZnEasy get: 'http://www.pharo-project.org/images/pharo.png' This is a PNG of about 180Kb. Now get is as a form ZnEasy getPng: 'http://www.pharo-project.org/images/pharo.png' If you already want to look at it now (ZnEasy getPng: 'http://www.pharo-project.org/images/pharo.png') asMorph openInHand Now serialize it in STON STON toStringPretty: (ZnEasy getPng: 'http://www.pharo-project.org/images/pharo.png') Or directly to a file FileStream newFileNamed: '/tmp/form.ston' do: [ :stream | stream lineEndConvention: #lf. STON put: (ZnEasy getPng: 'http://www.pharo-project.org/images/pharo.png') onStreamPretty: stream ] The result is 200Kb text file that looks like ColorForm { #bits : Bitmap [ 4294967295, 4294967295, 4294967295, ... 4294967295, 4294967040 ], #width : 375, #height : 135, #depth : 8, #offset : nil, #colors : [ TranslucentColor { #rgb : 1010156636, #cachedDepth : nil, #cachedBitPattern : nil, #alpha : 241 ⦠TranslucentColor { #rgb : 0, #cachedDepth : nil, #cachedBitPattern : nil, #alpha : 0 } ], #cachedDepth : nil, #cachedColormap : nil } It goes on with numbers in between for a very long time. Note that this is strictly based on the generic serialization behavior. I attach a bzip2 compressed copy of the file to this mail (form.ston.bz2). Uncompress it with bunzip2 and try (FileStream oldFileNamed: '/tmp/form.ston' do: [ :stream | STON fromStream: stream ]) asMorph openInHand Let me know if that works for you. Sven -- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill