public String read_atom()
{
int tag;
int len;
byte[] strbuf;
String atom;
tag = read1skip_version();
if (tag != OtpExternal.atomTag)
{
throw new OtpErlangDecodeException("wrong tag encountered, expected " + OtpExternal.atomTag + ", got " + tag);
}
len = read2BE();
strbuf = new byte[len];
this.readN(strbuf);
atom = OtpErlangString.newString(strbuf);
if (atom.Length > OtpExternal.maxAtomLength)
{
atom = atom.Substring(0, OtpExternal.maxAtomLength);
}
return atom;
}
/** * Create an atom from a stream containing an atom encoded in Erlang * external format. * * @param buf * the stream containing the encoded atom. * * @exception OtpErlangDecodeException * if the buffer does not contain a valid external * representation of an Erlang atom. */ public OtpErlangAtom(OtpInputStream buf) { atom = buf.read_atom(); }