Daniel Barla-Szabo wrote:

> Looking at the MSDN docs on Encoder / Decoder, I see a few comments
> like "Notes to inheritors" and "Notes to implementers", so it seems
> to me that the door has Microsoft has left the door for inheritance
> open on purpose.

For subclassing Encoding, Encoder and Decoder, that is definitely the case (see
for example the EBCDIC Encoding/Encoder/Decoder I linked to).

Overriding GetDecoder() etc sounds like the right thing because that's what's
implementation-specific for a FastASCIIEncoding. The actual Encoding class
should be the same, since ASCII is still ASCII, right?

> I believe the logical separation between Encoding and Encoder /
> Decoder is that the latter are allowed to (or supposed to) have state
> regarding what is being encoded / decoded, where the actual Encoding
> instance does not?

I agree. Dealing with multi-byte characters in a streaming fashion (which the
Encoding class must be able to do) usually requires state, since you need to
peek and so on when consuming bytes.

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to