public static OpPingResponse fromBytes(List <byte> list) { OpPingResponse newResp = new OpPingResponse(); ulong pos = 0; newResp.header = HeaderResponse.fromBytes(list, ref pos); newResp.responseStatus = list[(int)pos++]; return(newResp); }
public static OpGetResponse fromBytes(List <byte> list) { OpGetResponse newResp = new OpGetResponse(); ulong pos = 0; newResp.header = HeaderResponse.fromBytes(list, ref pos); newResp.valueLength = HotRodUtils.bytesToVLong(list, ref pos); if (newResp.valueLength != 0) { newResp.value = list.GetRange((int)pos, (int)(newResp.valueLength)); pos += newResp.valueLength; } return(newResp); }
public static HeaderResponse fromBytes(List <Byte> bytes, ref ulong pos) { HeaderResponse resp = new HeaderResponse(); if (bytes[0] != 0xA1) { throw new Exception("Bad magic number received: " + bytes[0]); } resp.magic = bytes[(int)pos++]; resp.messageId = HotRodUtils.bytesToVLong(bytes, ref pos); resp.opcode = bytes[(int)pos++]; resp.status = bytes[(int)pos++]; resp.topologyChangeMarker = bytes[(int)pos++]; if (resp.topologyChangeMarker != 0) { HashAwareTopologyInfo.fromBytes(bytes, ref pos); } return(resp); }