FUEL is a binary serialiser, in the new Pharo 7 stream approach, a stream is either binary or textual, not both, nor can they be switched on the fly. FileLocator temp / 'test.fuel' binaryWriteStreamDo: [ :out | FLSerializer newDefault serialize: { 'Foo'. #bar. Float pi. 42 } on: out ]. FileLocator temp / 'test.fuel' binaryReadStreamDo: [ :in | (FLMaterializer newDefault materializeFrom: in) root ].
On 8 Mar 2019, at 21:22, Konrad Hinsen <konrad.hinsen@fastmail.net> wrote:
Hi everyone,
after playing with FUEL in-memory (byte arrays) for a while, I am ready to attack files. But... that's not so easy.
At https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfu... I find the basic exxample
'demo.fuel' asFileReference writeStreamDo: [ :aStream | FLSerializer newDefault serialize: 'stringToSerialize' on: aStream binary ].
It fails because ZnCharacterWriteStream does not understand #binary.
Browsing around a bit, I found another way:
'demo.fuel' asFileReference writeStreamDo: [ :aStream | FLSerializer newDefault serialize: 'stringToSerialize' on: aStream binary ].
This works fine, the aStream being a ZnBufferedWriteStream. But on larger objects, it ends up failing in
FLBufferedWriteStream >> #nextBytePutAll:
which sends the message
stream nextBytesPutAll: collection
But ZnBufferedWriteStream does not understand nextBytesPutAll: because it is not a subclass of Stream for whatever reason.
Some further browing showed deprecated classes FileStream etc., and I kind of suspect that file streams in Pharo were changed at some point but FUEL still expects the old behavior.
Does anyone have an idea how to fix this, or work around it?
Thanks in advance, Konrad