Hi Sven, >> I'm trying to get started with Pharo doing something really simple - at >> least that's what I thought ... I'm trying to read a text file line by line. >> >> If I use File named: '/tmp/linex.txt' readStream nextLine I'll get a >> debugger telling me that BinaryFileStream does not understand nextLine. > > (File named: '/tmp/lines.txt') readStreamDo: [ :in | > | characterStream | > characterStream := ZnCharacterReadStream on: in. > Array streamContents: [ :out | > [ characterStream atEnd ] whileFalse: [ out nextPut: characterStream > nextLine ] ] ].
Thanks for the hint, Sven. Of all alternatives you gave I like the last one best as it does not load the entire contents of the (probably large) text file into memory. ZnCharacterReadStream belongs to the Zinc classes. I would have expected a generic character reading stream to be part of the core classes (whatever that means :-) and not a part of some HTTP component classes. But that may only be my limited understanding of Pharo so far :-) -dirk