stream not working with MemoryFileSystemFile

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

stream not working with MemoryFileSystemFile

Torsten Bergmann
Christophe Demarey
>I tried to create an in-memory file as following:
>(MemoryFileSystemFile named: 'Foo')
> writeStreamDo: [ :stream | stream nextPutAll: 'bar' ]
>
>Then I get an improper store into ByteArray. It looks like Character cannot be store in a byte array.
>I do not know if the bug is on the memory file system part or other.
>Any idea?

Why do you use MemoryFileSystemFile directly. Usually the FileSystem is
the starting point. And there it works:

|fs file|
fs := FileSystem memory.
file := fs / 'test'.
file writeStreamDo: [ :stream | stream nextPutAll: 'bar' ].
fs inspect

The nice thing is that you can now browse the file system and file contents
with the new GT Inspector.

Thanks
T.

Reply | Threaded
Open this post in threaded view
|

Re: stream not working with MemoryFileSystemFile

demarey

Le 1 juil. 2015 à 14:42, Torsten Bergmann a écrit :

> Christophe Demarey
>> I tried to create an in-memory file as following:
>> (MemoryFileSystemFile named: 'Foo')
>> writeStreamDo: [ :stream | stream nextPutAll: 'bar' ]
>>
>> Then I get an improper store into ByteArray. It looks like Character cannot be store in a byte array.
>> I do not know if the bug is on the memory file system part or other.
>> Any idea?
>
> Why do you use MemoryFileSystemFile directly. Usually the FileSystem is
> the starting point. And there it works:
>
> |fs file|
> fs := FileSystem memory.
> file := fs / 'test'.
> file writeStreamDo: [ :stream | stream nextPutAll: 'bar' ].
> fs inspect
>
> The nice thing is that you can now browse the file system and file contents
> with the new GT Inspector.
oh, perfect.
Looks like I was not using the good api.

Thanks,
Christophe

smime.p7s (5K) Download Attachment