K2Informatics.Erlnet.OtpInputStream.read_atom C# (CSharp) Method

read_atom() public method

public read_atom ( ) : String
return String
        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;
        }

Usage Example

Ejemplo n.º 1
0
 /**
  * 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();
 }