public void TestUtfStringBuilder2()
        {
            string source = "abcd012345\n\r\u0000\u00a4\u10fb\ufffdnjetty";
            Utf8StringBuilder buffer = new Utf8StringBuilder();
            buffer.Append(source);

            for (int i = 0; i < 100; i++)
            {
                source += "abcd012345\n\r\u0000\u00a4\u10fb\ufffdnjetty";
                buffer.Append("abcd012345\n\r\u0000\u00a4\u10fb\ufffdnjetty");
            }

            Assert.AreEqual(source, buffer.ToString());
            Assert.IsTrue(buffer.ToString().EndsWith("njetty"));
        }
        public void TestUtfStringBuilder1()
        {
            string source = "abcd012345\n\r\u0000\u00a4\u10fb\ufffdnjetty";

            for (int i = 0; i < 100; i++)
            {
                source += "abcd012345\n\r\u0000\u00a4\u10fb\ufffdnjetty";
            }

            byte[] bytes = System.Text.Encoding.UTF8.GetBytes(source);
            Utf8StringBuilder buffer = new Utf8StringBuilder();
            for (int i = 0; i < bytes.Length; i++)
            {
                buffer.Append(bytes[i]);
            }

            Assert.AreEqual(source, buffer.ToString());
            Assert.IsTrue(buffer.ToString().EndsWith("njetty"));
        }
示例#3
0
 public Utf8StringBuffer(int capacity, int growBy)
 {
     _sb = new Utf8StringBuilder(capacity, growBy);
 }
示例#4
0
 public Utf8StringBuffer(int capacity)
 {
     _sb = new Utf8StringBuilder(capacity);
 }
示例#5
0
 public Utf8StringBuffer()
 {
     _sb = new Utf8StringBuilder();
 }