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]); } }
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); }
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); }
public object Unpack(Packer packer) { return(CharSerializer.UnpackDirect(packer)); }
public void Pack(Packer packer, object obj) { CharSerializer.PackDirect(packer, (char)obj); }