[Q][RFI] Where ends a line of ASCII text ?
Yoshiki Ohshima
yoshiki at squeakland.org
Fri Mar 18 02:34:41 UTC 2005
Edgar,
> I appreciate your opinion.
> The answer it's for reading external files on different OS ,maybe the
> SocketStream is a bad example , it's not my intention said this particular
> have any wrong.
If you want to deal with external files, you use FileStream, right?
In 3.8 gamma Squeak, the FileStream (sub-)instance you create via:
FileStream fileNamed: 'foo.txt'.
creates the stream that is capable to absorb the end-of-line
difference.
In 3.8 gamma, you can say:
f := FileStream fileNamed: 'foo.txt'.
f wantsLineEndConversion: true.
f converter: Latin1TextConverter new.
lines := OrderedCollection new.
[(line := f nextLine) ~= nil] whileTrue: [lines add: line].
f close.
no matter what line-end-convention foo.txt uses. (You may want to use:
f converter: UTF8TextConverter new.
).
FileStream is a few exception where Squeak needs to deal with the
outside world. And it is handled reasonably well.
-- Yoshiki
More information about the Squeak-dev
mailing list
|