public static void writeVlqIntegral(BufferT buff, UInt64 val)
        {
            byte[] intTemp = new byte[10];

            int  ix      = 0;
            byte current = (byte)(val & 0x7f);

            val       >>= 7;
            intTemp[ix] = current;
            bool done = val == 0;

            while (!done)
            {
                current  = (byte)(val & 0x7f);
                current += 0x80;
                val    >>= 7;
                ++ix;
                intTemp[ix] = current;
                done        = val == 0;
            }

            while (ix != 0)
            {
                buff.appendUint8(intTemp[ix]);
                --ix;
            }
            buff.appendUint8(intTemp[0]);
        }
 public void composeString(string str)
 {
     buff.appendAscii(str);
     buff.appendUint8(0);
 }
        public void composeString(string str)
        {
            buff.appendUint8('\"');
            if (str.IndexOfAny(escapeChars) == -1)
            {
                buff.appendAscii(str);
            }
            else
            {
                // go char by char
                foreach (Char ch in str)
                {
                    switch (ch)
                    {
                    case '\\':
                        buff.appendUint8('\\');
                        buff.appendUint8('\\');
                        break;

                    case '\n':
                        buff.appendUint8('\\');
                        buff.appendUint8('n');
                        break;

                    case '\r':
                        buff.appendUint8('\\');
                        buff.appendUint8('r');
                        break;

                    case '\t':
                        buff.appendUint8('\\');
                        buff.appendUint8('t');
                        break;

                    case '\"':
                        buff.appendUint8('\\');
                        buff.appendUint8('\"');
                        break;

                    default:
                        buff.appendUint8(ch);
                        break;
                    }
                }
            }
            buff.appendUint8('\"');
        }