@Test public void decode () throws Exception { byte[] bytes1 = Bytes.resizableArray() .write1B(PID.getCode()) .writeNB(new ErlangAtom("popa@localhost").toBytes()) .write4B(Integer.MAX_VALUE) .write4B(Integer.MAX_VALUE) .write1B(Integer.MAX_VALUE) .arrayCopy(); try (val input = new OtpInputStream(bytes1)) { ErlangPid pid = ErlangTerm.newInstance(wrappedBuffer(bytes1)); OtpErlangPid otpPid = input.read_pid(); assertThat(pid.getDescriptor().getFullName()) .isEqualTo(otpPid.node()); assertThat(pid.getId()) .isEqualTo(otpPid.id()); assertThat(pid.getCreation()) .isEqualTo(otpPid.creation()); assertThat(pid.getSerial()) .isEqualTo(otpPid.serial()); } byte[] bytes2 = Bytes.resizableArray() .write1B(NEW_PID.getCode()) .writeNB(new ErlangAtom("popa@localhost").toBytes()) .write4B(Integer.MAX_VALUE) .write4B(Integer.MAX_VALUE) .write4B(Integer.MAX_VALUE) .arrayCopy(); try (val input = new OtpInputStream(bytes2)) { ErlangPid pid = ErlangTerm.newInstance(wrappedBuffer(bytes2)); OtpErlangPid otpPid = input.read_pid(); assertThat(pid.getDescriptor().getFullName()) .isEqualTo(otpPid.node()); assertThat(pid.getId()) .isEqualTo(otpPid.id()); assertThat(pid.getCreation()) .isEqualTo(otpPid.creation()); assertThat(pid.getSerial()) .isEqualTo(otpPid.serial()); } }
public final NodeDescriptor getDescriptor () { if (descriptor == null) { descriptor = NodeDescriptor.from(node.asText()); } return descriptor; }
ErlangPid extends ErlangTerm { public final NodeDescriptor getDescriptor () { if (descriptor == null) { descriptor = NodeDescriptor.from(node.asText()); } return descriptor; } }
ErlangPid extends ErlangTerm { public final NodeDescriptor getDescriptor () { if (descriptor == null) { descriptor = NodeDescriptor.from(node.asText()); } return descriptor; } ErlangPid(TermType type, @NonNull ByteBuf buffer); @Builder private  ErlangPid(TermType type, @NonNull String node, int id, int serial, int creation); }
ErlangPid extends ErlangTerm { public final NodeDescriptor getDescriptor () { if (descriptor == null) { descriptor = NodeDescriptor.from(node.asText()); } return descriptor; } ErlangPid(TermType type, @NonNull ByteBuf buffer); @Builder private  ErlangPid(TermType type, @NonNull String node, int id, int serial, int creation); @Override String asText(String defaultValue); @Override ErlangPid asPid(); @Override String toString(); final NodeDescriptor getDescriptor(); }
ErlangPid extends ErlangTerm { public final NodeDescriptor getDescriptor () { if (descriptor == null) { descriptor = NodeDescriptor.from(node.asText()); } return descriptor; } ErlangPid(TermType type, @NonNull ByteBuf buffer); @Builder private  ErlangPid(TermType type, @NonNull String node, int id, int serial, int creation); @Override String asText(String defaultValue); @Override ErlangPid asPid(); @Override String toString(); final NodeDescriptor getDescriptor();  }