MultiByteFileStream #converter - what does it do?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

MultiByteFileStream #converter - what does it do?

Sheridan Mahoney

 

Hi there,

I am still working my way through MultiByteFileStream tests, and have come across the messages #converter and #converter: .  I would like to be able to test these - could someone explain briefly how the converters are used in this class?

Many thanks,

Sheridan

 

 

 
Reply | Threaded
Open this post in threaded view
|

Re: MultiByteFileStream #converter - what does it do?

Sven Van Caekenberghe-2

> On 17 Dec 2014, at 19:42, [hidden email] wrote:
>
>  
> Hi there,
>
> I am still working my way through MultiByteFileStream tests, and have come across the messages #converter and #converter: .  I would like to be able to test these - could someone explain briefly how the converters are used in this class?

In order to convert from bytes to characters and vice versa, MultiByteFileStream uses a TextConverter subclass instance as a helper. The messages #nextFromStream: and #nextPut:onStream: are the main interface between the two.

The silly thing is that both MultiByteFileStream and TextConverter convert from wrongly encoded strings to correctly encoded strings. ZnCharacter[Read|Write]Stream and ZnCharacterEncoder do the correct thing.

Sven
Reply | Threaded
Open this post in threaded view
|

Re: MultiByteFileStream #converter - what does it do?

Guillermo Polito


On Wed, Dec 17, 2014 at 7:54 PM, Sven Van Caekenberghe <[hidden email]> wrote:

> On 17 Dec 2014, at 19:42, [hidden email] wrote:
>
>
> Hi there,
>
> I am still working my way through MultiByteFileStream tests, and have come across the messages #converter and #converter: .  I would like to be able to test these - could someone explain briefly how the converters are used in this class?

In order to convert from bytes to characters and vice versa, MultiByteFileStream uses a TextConverter subclass instance as a helper. The messages #nextFromStream: and #nextPut:onStream: are the main interface between the two.

This guy is loudly crying for a decorator. I wonder when Xtreams could be pushed...
 

The silly thing is that both MultiByteFileStream and TextConverter convert from wrongly encoded strings to correctly encoded strings.

So it corrects encodings? :P I didn't know that! They are flawless!!!
 
ZnCharacter[Read|Write]Stream and ZnCharacterEncoder do the correct thing.

Sven
Reply | Threaded
Open this post in threaded view
|

Re: MultiByteFileStream #converter - what does it do?

stepharo
In reply to this post by Sven Van Caekenberghe-2
Sven

could we not nuke

MultiByteFileStream

and use ZnCharacterStreams?


Le 17/12/14 19:54, Sven Van Caekenberghe a écrit :

>> On 17 Dec 2014, at 19:42, [hidden email] wrote:
>>
>>  
>> Hi there,
>>
>> I am still working my way through MultiByteFileStream tests, and have come across the messages #converter and #converter: .  I would like to be able to test these - could someone explain briefly how the converters are used in this class?
> In order to convert from bytes to characters and vice versa, MultiByteFileStream uses a TextConverter subclass instance as a helper. The messages #nextFromStream: and #nextPut:onStream: are the main interface between the two.
>
> The silly thing is that both MultiByteFileStream and TextConverter convert from wrongly encoded strings to correctly encoded strings. ZnCharacter[Read|Write]Stream and ZnCharacterEncoder do the correct thing.
>
> Sven
>


Reply | Threaded
Open this post in threaded view
|

Re: MultiByteFileStream #converter - what does it do?

Sven Van Caekenberghe-2
Yes, one day we have to do this.

There is also Xtreams which is a broader, more interesting way of rethinking the subject.

But the main issue is: the stream API is way too broad, so any change will involve slimming down or changing the API and hence the users. That is a lot of work.

> On 18 Dec 2014, at 23:51, stepharo <[hidden email]> wrote:
>
> Sven
>
> could we not nuke
>
> MultiByteFileStream
>
> and use ZnCharacterStreams?
>
>
> Le 17/12/14 19:54, Sven Van Caekenberghe a écrit :
>>> On 17 Dec 2014, at 19:42, [hidden email] wrote:
>>>
>>>  Hi there,
>>>
>>> I am still working my way through MultiByteFileStream tests, and have come across the messages #converter and #converter: .  I would like to be able to test these - could someone explain briefly how the converters are used in this class?
>> In order to convert from bytes to characters and vice versa, MultiByteFileStream uses a TextConverter subclass instance as a helper. The messages #nextFromStream: and #nextPut:onStream: are the main interface between the two.
>>
>> The silly thing is that both MultiByteFileStream and TextConverter convert from wrongly encoded strings to correctly encoded strings. ZnCharacter[Read|Write]Stream and ZnCharacterEncoder do the correct thing.
>>
>> Sven
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: MultiByteFileStream #converter - what does it do?

stepharo
Could you think about a roadmap?
Because we are doing often actions that require a lot of work but people
do not notice it.

Stef

> Yes, one day we have to do this.
>
> There is also Xtreams which is a broader, more interesting way of rethinking the subject.
>
> But the main issue is: the stream API is way too broad, so any change will involve slimming down or changing the API and hence the users. That is a lot of work.
>
>> On 18 Dec 2014, at 23:51, stepharo <[hidden email]> wrote:
>>
>> Sven
>>
>> could we not nuke
>>
>> MultiByteFileStream
>>
>> and use ZnCharacterStreams?
>>
>>
>> Le 17/12/14 19:54, Sven Van Caekenberghe a écrit :
>>>> On 17 Dec 2014, at 19:42, [hidden email] wrote:
>>>>
>>>>   Hi there,
>>>>
>>>> I am still working my way through MultiByteFileStream tests, and have come across the messages #converter and #converter: .  I would like to be able to test these - could someone explain briefly how the converters are used in this class?
>>> In order to convert from bytes to characters and vice versa, MultiByteFileStream uses a TextConverter subclass instance as a helper. The messages #nextFromStream: and #nextPut:onStream: are the main interface between the two.
>>>
>>> The silly thing is that both MultiByteFileStream and TextConverter convert from wrongly encoded strings to correctly encoded strings. ZnCharacter[Read|Write]Stream and ZnCharacterEncoder do the correct thing.
>>>
>>> Sven
>>>
>>
>
>