Thrift.Protocol.TJSONProtocol.WriteJSONBase64 C# (CSharp) Method

WriteJSONBase64() private method

Write out contents of byte array b as a JSON string with base-64 encoded data
private WriteJSONBase64 ( byte b ) : void
b byte
return void
        private void WriteJSONBase64(byte[] b)
        {
            context.Write();
            trans.Write(QUOTE);

            int len = b.Length;
            int off = 0;

            while (len >= 3)
            {
                // Encode 3 bytes at a time
                TBase64Utils.encode(b, off, 3, tempBuffer, 0);
                trans.Write(tempBuffer, 0, 4);
                off += 3;
                len -= 3;
            }
            if (len > 0)
            {
                // Encode remainder
                TBase64Utils.encode(b, off, len, tempBuffer, 0);
                trans.Write(tempBuffer, 0, len + 1);
            }

            trans.Write(QUOTE);
        }