Esempio n. 1
0
  /**
   * Read an Erlang PID from the stream.
   *
   * @return the value of the PID.
   * @exception IOException if the next term in the stream is not an Erlang PID.
   */
  public EPID read_pid() throws IOException {
    EAtom node;
    int id;
    int serial;
    int creation;
    int tag;

    tag = read1skip_version();

    if (tag != EExternal.pidTag) {
      throw new IOException("Wrong tag encountered, expected " + EExternal.pidTag + ", got " + tag);
    }

    node = read_atom();
    id = read4BE() & 0x7fff; // 15 bits
    serial = read4BE() & 0x1fff; // 13 bits
    creation = read1() & 0x03; // 2 bits

    return EPID.make(node, id, serial, creation);
  }