public static void Serialize (Stream stream, ReplyReadChunk instance)
		{
			if (instance.ChunkData != null) {
				ProtocolParser.WriteKey (stream, new ProtocolBuffers.Key (1, Wire.LengthDelimited));
				ProtocolParser.WriteBytes (stream, instance.ChunkData);
			}
		}
		public static byte[] SerializeToBytes (ReplyReadChunk instance)
		{
			using (MemoryStream ms = new MemoryStream()) {
				Serialize (ms, instance);
				return ms.ToArray ();
			}
		}
示例#3
0
        void ProcessReadChunk()
        {
            RequestReadChunk request = RequestReadChunk.Deserialize (ProtocolParser.ReadBytes (input));
            ReplyReadChunk reply = new ReplyReadChunk ();
            Chunk c = localRepo.ReadChunk (ChunkHash.FromHashBytes (request.ChunkHash));
            reply.ChunkData = c.Data;

            ProtocolParser.WriteBytes (output, ReplyReadChunk.SerializeToBytes (reply));
        }
		public static ReplyReadChunk Deserialize (Stream stream)
		{
			ReplyReadChunk instance = new ReplyReadChunk ();
			Deserialize (stream, instance);
			return instance;
		}