K2Informatics.Erlnet.OtpInputStream.read_pid C# (CSharp) Method

read_pid() public method

public read_pid ( ) : OtpErlangPid
return OtpErlangPid
        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);
        }

Usage Example

Ejemplo n.º 1
0
        /**
         * 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;
        }