@Test public void decode () throws Exception { val value1 = "hello"; val bytes1 = Bytes.resizableArray() .write1B(SMALL_ATOM_UTF8.getCode()) .write1B(value1.getBytes(UTF_8).length) .writeNB(value1.getBytes(UTF_8)) .arrayCopy(); try (val input = new OtpInputStream(bytes1)) { ErlangAtom atom = ErlangTerm.newInstance(Unpooled.wrappedBuffer(bytes1)); assertThat(atom.asText()) .isEqualTo(input.read_atom()); } val value2 = "попа"; val bytes2 = Bytes.resizableArray() .write1B(ATOM_UTF8.getCode()) .write2B(value2.getBytes(UTF_8).length) .writeNB(value2.getBytes(UTF_8)) .arrayCopy(); try (val input = new OtpInputStream(bytes2)) { ErlangAtom atom = ErlangTerm.newInstance(Unpooled.wrappedBuffer(bytes2)); assertThat(atom.asText()) .isEqualTo(input.read_atom()); } }
@Override public String asText (String defaultValue) { return getValue(); }
ErlangAtom extends ErlangTerm { @Override public String asText (String defaultValue) { return getValue(); } }
ErlangAtom extends ErlangTerm { @Override public String asText (String defaultValue) { return getValue(); } ErlangAtom(TermType type, ByteBuf buffer);  ErlangAtom(boolean value);  ErlangAtom(String value);  ErlangAtom(@NonNull String value, @NonNull Charset charset); }
ErlangAtom extends ErlangTerm { @Override public String asText (String defaultValue) { return getValue(); } ErlangAtom(TermType type, ByteBuf buffer);  ErlangAtom(boolean value);  ErlangAtom(String value);  ErlangAtom(@NonNull String value, @NonNull Charset charset); @Override boolean isBoolean(); @Override boolean asBoolean(boolean defaultValue); @Override String asText(String defaultValue); @Override byte[] asBinary(byte[] defaultValue); @Override ErlangAtom asAtom(); @Override boolean isTextual(); }
ErlangAtom extends ErlangTerm { @Override public String asText (String defaultValue) { return getValue(); } ErlangAtom(TermType type, ByteBuf buffer);  ErlangAtom(boolean value);  ErlangAtom(String value);  ErlangAtom(@NonNull String value, @NonNull Charset charset); @Override boolean isBoolean(); @Override boolean asBoolean(boolean defaultValue); @Override String asText(String defaultValue); @Override byte[] asBinary(byte[] defaultValue); @Override ErlangAtom asAtom(); @Override boolean isTextual(); static final ErlangAtom ATOM_TRUE; static final ErlangAtom ATOM_FALSE; }