Ejemplo n.º 1
0
		public static void Serialize (Stream stream, RequestReadChunk instance)
		{
			if (instance.ChunkHash == null)
				throw new ArgumentNullException ("ChunkHash", "Required by proto specification.");
			ProtocolParser.WriteKey (stream, new ProtocolBuffers.Key (1, Wire.LengthDelimited));
			ProtocolParser.WriteBytes (stream, instance.ChunkHash);
		}
Ejemplo n.º 2
0
		public static byte[] SerializeToBytes (RequestReadChunk instance)
		{
			using (MemoryStream ms = new MemoryStream()) {
				Serialize (ms, instance);
				return ms.ToArray ();
			}
		}
Ejemplo n.º 3
0
		public static RequestReadChunk Deserialize (Stream stream)
		{
			RequestReadChunk instance = new RequestReadChunk ();
			Deserialize (stream, instance);
			return instance;
		}