System.Xml.XmlUTF8NodeWriter.InternalWriteBase64TextAsync C# (CSharp) Method

InternalWriteBase64TextAsync() private method

private InternalWriteBase64TextAsync ( byte buffer, int offset, int count ) : Task
buffer byte
offset int
count int
return Task
        private async Task InternalWriteBase64TextAsync(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;
                BytesWithOffset bufferResult = await GetBufferAsync(charCount).ConfigureAwait(false);
                byte[] chars = bufferResult.Bytes;
                charOffset = bufferResult.Offset;
                Advance(encoding.GetChars(buffer, offset, byteCount, chars, charOffset));
                offset += byteCount;
                count -= byteCount;
            }
            if (count > 0)
            {
                int charOffset;
                BytesWithOffset bufferResult = await GetBufferAsync(4).ConfigureAwait(false);
                byte[] chars = bufferResult.Bytes;
                charOffset = bufferResult.Offset;
                Advance(encoding.GetChars(buffer, offset, count, chars, charOffset));
            }
        }