internal unsafe EncodingByteBuffer(Encoding inEncoding, EncoderNLS inEncoder,
byte* inByteStart, int inByteCount, char* inCharStart, int inCharCount)
{
this.enc = inEncoding;
this.encoder = inEncoder;
this.charStart = inCharStart;
this.chars = inCharStart;
this.charEnd = inCharStart + inCharCount;
this.bytes = inByteStart;
this.byteStart = inByteStart;
this.byteEnd = inByteStart + inByteCount;
if (this.encoder == null)
this.fallbackBuffer = enc.EncoderFallback.CreateFallbackBuffer();
else
{
this.fallbackBuffer = this.encoder.FallbackBuffer;
// If we're not converting we must not have data in our fallback buffer
if (encoder.m_throwOnOverflow && encoder.InternalHasFallbackBuffer &&
this.fallbackBuffer.Remaining > 0)
throw new ArgumentException(Environment.GetResourceString("Argument_EncoderFallbackNotEmpty",
encoder.Encoding.EncodingName, encoder.Fallback.GetType()));
}
fallbackBuffer.InternalInitialize(chars, charEnd, encoder, bytes != null);
}