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