private void InternalWriteBase64Text(byte[] buffer, int offset, int count)
{
Base64Encoding encoding = XmlConverter.Base64Encoding;
while (count >= 3)
{
int byteCount = Math.Min(bufferLength / 4 * 3, count - count % 3);
int charCount = byteCount / 3 * 4;
int charOffset;
byte[] chars = GetBuffer(charCount, out charOffset);
Advance(encoding.GetChars(buffer, offset, byteCount, chars, charOffset));
offset += byteCount;
count -= byteCount;
}
if (count > 0)
{
int charOffset;
byte[] chars = GetBuffer(4, out charOffset);
Advance(encoding.GetChars(buffer, offset, count, chars, charOffset));
}
}