/// <inheritdoc/> public Byte[] Encode(Response response) { DatagramWriter writer = new DatagramWriter(); Serialize(writer, response, response.Code); return(writer.ToByteArray()); }
/// <inheritdoc/> public Byte[] Encode(EmptyMessage message) { DatagramWriter writer = new DatagramWriter(); Serialize(writer, message, Code.Empty); return(writer.ToByteArray()); }
/// <inheritdoc/> public Byte[] Encode(Request request) { DatagramWriter writer = new DatagramWriter(); Serialize(writer, request, request.Code); return(writer.ToByteArray()); }
/// <summary> /// Serializes a message. /// </summary> /// <param name="writer">the writer</param> /// <param name="message">the message to write</param> /// <param name="code">the code</param> protected abstract void Serialize(DatagramWriter writer, Message message, Int32 code);