2

the .net Standard library contains a class Decoder with a method Convert.

This method decodes the binary data in the input array to character data in the output array. It has an output parameter completed to indicate if all bytes passed in were used.

This method is documented to throw an ArgumentException if

The output buffer is too small to contain any of the converted input.

So far, so good, if there is not enough space in the output buffer, completed is false, if the output buffer has no available space at all, it throws an ArgumentException.

However, the exceptions documentation goes on to say

The output buffer should be greater than or equal to the size indicated by the GetCharCount method.

which has me confused. If the output buffer should be greater or equal to size of the GetCharCount method, shouldn't the completed output parameter always be true? If so, what's it use. How is (non)completion signalled exactly?

Martijn
  • 11,964
  • 12
  • 50
  • 96

0 Answers0