示例#1
0
 // reads message content in JSON format from the current position.
 public void Read(Message msg)
 {
     _dc = new char[iCharBufSz];
     _cc = GetNextCharJs();
     _tlast = Next();
     AsMessage(msg, msg.GetDescriptor());
 }
示例#2
0
 // reads message content from Google Protocol Buffers stream.
 public void Read(Message msg, int size)
 {
     if (size > 0)
     {
         _level = 0;
         // start protobuf stream parsing.
         _storage.Limit = _fsz = size;
         _wirefmt = Pbs.iString;
         GetMessage(msg, msg.GetDescriptor());
         // check if we parsed message to the limit.
         if (_storage.Limit > 0) 
             throw new ProtoBufException("incomplete message data");
     }
     else if (size < 0) 
         throw new ArgumentException("message size");
 }