public static int Encode(NegotiateResponse sno, DirectBuffer directBuffer, int bufferOffset) { // we position the car encoder on the direct buffer, at the correct offset (ie. just after the header) sno.WrapForEncode(directBuffer, bufferOffset); byte[] trder = Encoding.GetEncoding(NegotiateResponse.CredentialsCharacterEncoding).GetBytes("12345"); sno.SetCredentials(trder, 0, trder.Length); return(sno.Size); }
public static void Decode(NegotiateResponse rsp, DirectBuffer directBuffer, int bufferOffset, int actingBlockLength, int actingVersion) { var buffer = new byte[128]; var sb = new StringBuilder(); // position the car flyweight just after the header on the DirectBuffer rsp.WrapForDecode(directBuffer, bufferOffset, actingBlockLength, actingVersion); int l = rsp.CredentialsLength(); rsp.GetCredentials(buffer, 0, l); sb.Append("\ncar.manufacturer=").Append(Encoding.GetEncoding("UTF-8").GetString(buffer, 0, buffer.Length)); Console.WriteLine(sb.ToString()); }
public NegotiateResponse() { _parentMessage = this; }