I am quickly answering without testing (I can do that tomorrow otherwise). Did you see #serializeToByteArray: ? and FLInMemoryBasicSerializationTest? This is not filesytem, but still an in-memory stream.
Also, did you make sure the in memory stream of FileStream is binary and not text? Try sending #binary or so... Let us know, On Tue, Sep 1, 2015 at 8:01 PM, Juraj Kubelka <juraj.kube...@gmail.com> wrote: > Hi, > > I am writing test case that uses following strategy: > > -=-=- > | memory file | > memory := FileSystem memory. > file := memory workingDirectory / 'file.fuel'. > FLSerializer serialize: {1. 2. 3} toFileNamed: file. > -=-=- > > But it does not work because in StandardFileStream class>> > #forceNewFileNamed: a "self fullName: fileName.” is called and it returns a > string. So it tries to create the file in the default real file system; not > in the memory file system. FLSerializer calls it in: > > -=-=- > serialize: anObject toFileNamed: aFilename > "Serialize the graph starting at the root object received and > answers the FLSerialization object" > StandardFileStream > forceNewFileNamed: aFilename > do: [ :aFileStream | > aFileStream binary. > self serialize: anObject on: aFileStream ] > -=-=- > > using a stream neither work: > > -=-=- > | disk file | > disk := FileSystem memory. > file := disk workingDirectory / 'file.fuel'. > file writeStreamDo: [ :aStream | > FLSerializer serialize: {1. 2. 3} on: aStream ]. > -=-=- > > It produces an improper indexable object. > > The only code that works is that one: > -=-=- > | file | > file := FileLocator workingDirectory / 'file.fuel'. > FLSerializer serialize: {1. 2. 3} toFileNamed: file. > -=-=- > > I think that using MemoryStore is a clean way to test code that stores > contents into a file. > How can I use FLSerializer and MemoryStore together? > > Thanks! > Juraj > -- Mariano http://marianopeck.wordpress.com