public OtpErlangPid read_pid()
{
String node;
int id;
int serial;
int creation;
int tag;
tag = read1skip_version();
if (tag != OtpExternal.pidTag)
{
throw new OtpErlangDecodeException("Wrong tag encountered, expected " + OtpExternal.pidTag
+ ", got " + tag);
}
node = read_atom();
id = read4BE() & 0x7fff; // 15 bits
serial = read4BE() & 0x1fff; // 13 bits
creation = read1() & 0x03; // 2 bits
return new OtpErlangPid(node, id, serial, creation);
}
/** * Create an Erlang PID from a stream containing a PID encoded in Erlang * external format. * * @param buf * the stream containing the encoded PID. * * @exception OtpErlangDecodeException * if the buffer does not contain a valid external * representation of an Erlang PID. */ public OtpErlangPid(OtpInputStream buf) { OtpErlangPid p = buf.read_pid(); node = p.Node; id = p.Id; serial = p.Serial; creation = p.Creation; }