As I just wrote a few days ago, you must use #fileStreamDo: or #fileStreamWriteable:do: to get the traditional system stream that supports ascii/binary and various convertors. The streams built into FileSystem are minimal ANSI streams. They are supposed to be wrapped by something more powerful. I was told that Xtreams works well with FileSystem. Maybe Nile could be made to work as well? Lukas On 19 November 2011 17:03, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Doru
FS should be usable so if you have suggestions and code please send them.
Stef
Hi,
Thanks. I know that the ByteArray is the data structure, but I would like to get a stream that decodes the information and lets me traverse characters, rather than bytes.
By retrieving "aReference readStream contents asString" I first get all the ByteArray in memory, and then create another string from it also in memory. If my file is large, this is not a feasible solution.
Like Norbert said, I would like to get some support to have a converter in the stream.
For example, outside of Filesystem, we can do something like:
FileStream readOnlyFileNamed: 'aFileName'. stream converter: TextConverter default.
So, I guess, the only way right now is to not use the FSStream, but to get from an FSReference to the FileStream.
Do, we want to bring the FileStream closer to FileSystem?
Cheers, Doru
On 18 Nov 2011, at 07:41, Max Leske wrote:
Hi Doru
The last time I used FS that was the way to do it. Maybe what you want could be accomplished by adding convenience methods to FSReadStream like #stringContents or something. Anyway, I agree with Norbert that a ByteArray is really the data structure that you should expect to get from a file.
Cheers, Max
On 17.11.2011, at 22:01, Tudor Girba wrote:
Hi,
I am using Filesystem, and I would like to get a read stream that provides a string instead of bytes.
If I do "aReference readStream", I get a FSReadStream which is a byte stream.
To get to the string, I now do the ugly: "aReference readStream contents asString"
Is there a cleverer way?
Cheers, Doru
-- www.tudorgirba.com
"What we can governs what we wish."
-- www.tudorgirba.com
Things happen when they happen, not when you talk about them happening.
-- Lukas Renggli www.lukas-renggli.ch