Ok now who will do that? Stef
On Sep 13, 2011, at 6:12 PM, Igor Stasenko wrote: > On 13 September 2011 16:41, Lukas Renggli <[email protected]> wrote: >> Then you also need to specify an encoding. Otherwise it does not make >> sense for a FSReadStream to return a String. >> >> Strictly speaking the FSWriteStream shouldn't accept a String as input >> either. >> > > +1000 > > there should be a clear separation between binary and text. > I think that mixing the code for text and binary modes in single class > is a source of errors and confusion. > > The code: > > stream := (working / 'foo.txt') writeStream. > > should be something like: > > > stream := (working / 'foo.txt') writeStream textStream. > > where textStream should answer the wrapper stream around the original > stream, something like: > > textStream > ^ UnicodeTextWriteStream on: self > > > then when you do: > > stream nextPutAll: 'abc' > > the wrapper stream takes care about converting input string into > bytearray and then passing it further to basic stream. > Of course there could be an optimization, if input string are > bytestring etc , but model should be separated. > > >> Lukas >> >> On 13 September 2011 16:36, Stéphane Ducasse <[email protected]> >> wrote: >>> or strings and widestrings. >>> >>> Stef >>> On Sep 13, 2011, at 4:11 PM, Alexandre Bergel wrote: >>> >>>> Looks like there is a confusion between binary and text stream >>>> >>>> Alexandre >>>> >>>> On 13 Sep 2011, at 11:09, Stéphane Ducasse wrote: >>>> >>>>> | working stream | >>>>> working := FSFilesystem disk workingDirectory. >>>>> stream := (working / 'foo.txt') writeStream. >>>>> stream nextPutAll: 'Hello World'. >>>>> stream close. >>>>> stream := (working / 'foo.txt') readStream. >>>>> stream contents. >>>>> returns >>>>> #[72 101 108 108 111 32 87 111 114 108 100] >>>>> >>>>> instead of 'Hello World' >>>>> >>>>> Does anybody have a fix..? >>>>> >>>>> Stef ( editing FS chapter). >>>>> >>>> >>>> -- >>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >>>> Alexandre Bergel http://www.bergel.eu >>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >>>> >>>> >>>> >>>> >>>> >>>> >>> >>> >>> >> >> >> >> -- >> Lukas Renggli >> www.lukas-renggli.ch >> >> > > > > -- > Best regards, > Igor Stasenko AKA sig. >
