コード例 #1
0
 static object StringUnpacker(CustomPacker packer, MsgPackReader reader)
 {
     if (!reader.Read())
     {
         throw new FormatException();
     }
     if (reader.Type == TypePrefixes.Nil)
     {
         return(null);
     }
     if (!reader.IsRaw())
     {
         throw new FormatException();
     }
     packer.CheckBufferSize((int)reader.Length);
     reader.ReadValueRaw(packer._buf, 0, (int)reader.Length);
     return(Encoding.UTF8.GetString(packer._buf, 0, (int)reader.Length));
 }
コード例 #2
0
 static void StringPacker(CustomPacker packer, MsgPackWriter writer, object o)
 {
     writer.Write(Encoding.UTF8.GetBytes((string)o));
 }