Agree with Igor, legacy streams suck.
I think that Colin purpose was to produce a cleaner FSStream, but
maybe now he is thinking of using Xtreams.
Otherwise, it is too tempting to bring the mud back for very noble
compatibility reasons.

Nicolas

Le 21 février 2012 01:40, Igor Stasenko <[email protected]> a écrit :
> On 20 February 2012 17:11, Sven Van Caekenberghe <[email protected]> wrote:
>> This is silly, because Zinc also only works with or needs binary streams.
>>
>> But I have to know what kind of stream comes in, so I think it would not 
>> hurt to implement
>>
>> isBinary
>>        "I am always binary"
>>
>>        ^ true
>>
>
> I would love to have streams at some day, which don't trouble
> themselves about being bivalent.
> Imo all i/o streams should be inherently binary, and only wrapper
> streams which can allow reading/writing text into them.
>
> its clear that in modern times it is not enough to have just two
> modes: text or binary.
> a 'text' is very vague term today, because next question is what its
> encoding, what is line ending convention etc etc.. the whole bunch of
> variations which is better to implement by using wrappers.
>
> Btw, Sven
>
> isBinary
>        ^ binary isNil
>                ifTrue: [ stream isBinary ]
>                ifFalse: [ binary ]
>
> can be written as:
>
> isBinary
>        ^ binary ifNil: [ stream isBinary ]
>
> or you doing it on purpose?
>
>> Sven
>>
>> On 20 Feb 2012, at 16:53, Stéphane Ducasse wrote:
>>
>>> camillo
>>>
>>> I'm trying your script with the latest image.
>>>
>>>
>>> | f files|
>>> f := FSFilesystem disk workingDirectory / 'www.squeaksource.com' / 'Kozen'.
>>> files := f glob: [ :each| each basename endsWith: '.mcz'].
>>>
>>> files do: [ :file ||entity stream|
>>>       stream := file readStream.
>>>       (entity := ZnStreamingEntity type: ZnMimeType applicationOctetStream)
>>>               stream: stream;
>>>               contentLength: stream size.
>>>       Transcript show: file; cr.
>>>       "upload the version to gemstone"
>>>       ZnClient new
>>>               systemPolicy;
>>>               beOneShot;
>>>               signalProgress: true;
>>>               ifFail: [ :exception | Transcript show: file basename; show: 
>>> ' '; print: exception ];
>>>               username: 'sd' password: 'sn00py_';
>>>               entity: entity;
>>>               url: ( 'http://ss3.gemstone.com/ss/Kozen/', file basename);
>>>               put ]
>>>       displayingProgress: 'Uploading mcz'
>>>
>>>
>>> apparently FSReadStream does not know isBinary
>>>
>>>
>>>
>>> streamFrom: inputStream to: outputStream size: totalSize
>>>       | bufferSize buffer leftToRead |
>>>       bufferSize := 4096 min: totalSize.
>>>       buffer := (inputStream isBinary ifTrue: [ ByteArray ] ifFalse: [ 
>>> String ]) new: bufferSize.
>>>                                       ^^^^^^^^^^
>>>       leftToRead := totalSize.
>>>       [ leftToRead > 0 ]
>>>               whileTrue: [ | readCount |
>>>                       readCount := bufferSize min: leftToRead.
>>>                       inputStream next: readCount into: buffer.
>>>                       leftToRead := leftToRead - readCount.
>>>                       outputStream next: readCount putAll: buffer 
>>> startingAt: 1 ]
>>
>>
>
>
>
> --
> Best regards,
> Igor Stasenko.
>

Reply via email to