[squeak-dev] Re: SocketSteam: Switching ascii/binary modes

Igor Stasenko siguctua at gmail.com
Tue Mar 16 03:14:01 UTC 2010

On 16 March 2010 04:46, Andreas Raab <andreas.raab at gmx.de> wrote:
> On 3/15/2010 7:44 PM, Igor Stasenko wrote:
>> Since SocketStream caching the data it reads, then instead of
>> resetting the buffers it should convert them and avoid losing the
>> data.
>> What you think is an appropriate solution to this?
> Don't "reset" the buffers; simply convert them to the proper ascii/binary
> format.

There could be an alternative approach:
- keep buffers in a single (binary) format and covert an output
depending on mode.

The choice is, when you should pay the conversion price:
- each time you read something
- each time you switching the mode

If input is a mix of ascii/binary content, it will be very ineffective
converting the cache each time mode switching.
For example - HTTP 'transfer-encoding: chunked'.
Content may be a binary data, but it could be chunked, then input
becomes a mix of
binary data and hexadecimal ascii values, and crlf's.

So, it requires mode deep analyzis than just saying 'convert it' :)

> Cheers,
>  - Andreas

Best regards,
Igor Stasenko AKA sig.

More information about the Squeak-dev mailing list