System.Text.EncodingNLS.ThrowCharsOverflow C# (CSharp) Метод

ThrowCharsOverflow() приватный Метод

private ThrowCharsOverflow ( DecoderNLS decoder, bool nothingDecoded ) : void
decoder DecoderNLS
nothingDecoded bool
Результат void
        internal void ThrowCharsOverflow(DecoderNLS decoder, bool nothingDecoded)
        {
            if (decoder == null || decoder.m_throwOnOverflow || nothingDecoded)
            {
                if (decoder != null && decoder.InternalHasFallbackBuffer)
                    decoder.FallbackBuffer.Reset();

                // Special message to include fallback type in case fallback's GetMaxCharCount is broken
                // This happens if user has implemented a decoder fallback with a broken GetMaxCharCount
                ThrowCharsOverflow();
            }

            // If we didn't throw, we are in convert and have to remember our flushing
            decoder.ClearMustFlush();
        }

Same methods

EncodingNLS::ThrowCharsOverflow ( ) : void

Usage Example

        internal unsafe bool AddChar(char ch, int numBytes)
        {
            if (_chars != null)
            {
                if (_chars >= _charEnd)
                {
                    // Throw maybe
                    _bytes -= numBytes;                                      // Didn't encode these bytes
                    _enc.ThrowCharsOverflow(_decoder, _bytes <= _byteStart); // Throw?
                    return(false);                                           // No throw, but no store either
                }

                *(_chars++) = ch;
            }
            _charCountResult++;
            return(true);
        }