protected static McastMember getMember(byte[] data) {
//package looks like
//alive - 8 bytes
//port - 4 bytes
//host - 4 bytes
//nlen - 4 bytes
//name - nlen bytes
//dlen - 4 bytes
//domain - dlen bytes
byte[] alived = new byte[8];
System.arraycopy(data, 0, alived, 0, 8);
byte[] portd = new byte[4];
System.arraycopy(data, 8, portd, 0, 4);
byte[] addr = new byte[4];
System.arraycopy(data, 12, addr, 0, 4);
//FIXME control the nlen
byte[] nlend = new byte[4];
System.arraycopy(data, 16, nlend, 0, 4);
int nlen = XByteBuffer.toInt(nlend, 0);
byte[] named = new byte[nlen];
System.arraycopy(data, 20, named, 0, named.length);
//FIXME control the dlen
byte[] dlend = new byte[4];
System.arraycopy(data, nlen + 20, dlend, 0, 4);
int dlen = XByteBuffer.toInt(dlend, 0);
byte[] domaind = new byte[dlen];
System.arraycopy(data, nlen + 24, domaind, 0, domaind.length);
return new McastMember(new String(named),
new String(domaind),
addressToString(addr),
XByteBuffer.toInt(portd, 0),
XByteBuffer.toLong(alived, 0));
}
Deserializes a member from data sent over the wire |