2012/8/1 Sven Van Caekenberghe <[email protected]>

> Paul,
>
> On 31 Jul 2012, at 18:25, Paul DeBruicker <[email protected]> wrote:
>
> > Is there an easy/standard way to open an ascii file and iterate through
> it line by line?
> >
> >
> > I want to put several files contents into their own OrderedCollections
> and then do awful things to them. The files are ~500MB each
>
> This uses code that is already in Pharo:
>
> '/tmp/foo.txt' asFileReference readStreamDo: [ :readStream |
>         | lineReader |
>         lineReader := ZnLineReader on: readStream.
>         Array streamContents: [ :output |
>                 | line |
>                 [ (line := lineReader nextLine) isEmpty ]
>                         whileFalse: [ output nextPut: line ] ] ]
>
> Works with any line end convention. Check the class comment of
> ZnLineReader.
>
>
No, it doesn't work in latest Pharo 1.4 (14557)
MessageNotUnderstood: FileSystemReadStream>>isBinary

Cheers,

Hernán

Reply via email to