예제 #1
0
        public static void PackDirect(Packer packer, string obj)
        {
            var length = obj.Length;

            Int32Serializer.PackDirect(packer, length);
            for (int i = 0; i < obj.Length; ++i)
            {
                CharSerializer.PackDirect(packer, obj[i]);
            }
        }
예제 #2
0
        public static string UnpackDirect(Packer packer)
        {
            var length = Int32Serializer.UnpackDirect(packer);
            var sb     = new System.Text.StringBuilder(length);

            sb.Clear();
            sb.Capacity = length;
            for (int i = 0; i < length; ++i)
            {
                sb.Append(CharSerializer.UnpackDirect(packer));
            }
            var res = sb.ToString();

            return(res);
        }
예제 #3
0
        public static string UnpackDirect(Packer packer)
        {
            var length = Int32Serializer.UnpackDirect(packer);
            var sb     = PoolClass <System.Text.StringBuilder> .Spawn();

            sb.Clear();
            sb.Capacity = length;
            for (int i = 0; i < length; ++i)
            {
                sb.Append(CharSerializer.UnpackDirect(packer));
            }
            var res = sb.ToString();

            PoolClass <System.Text.StringBuilder> .Recycle(ref sb);

            return(res);
        }
예제 #4
0
 public object Unpack(Packer packer)
 {
     return(CharSerializer.UnpackDirect(packer));
 }
예제 #5
0
 public void Pack(Packer packer, object obj)
 {
     CharSerializer.PackDirect(packer, (char)obj);
 }