public long readBE(int n)
{
byte[] b = new byte[n];
if (base.Read(b, 0, b.Length) < b.Length)
{
throw new OtpErlangDecodeException("Cannot read from input stream");
}
long v = 0;
for (int i = 0; i < n; i++)
{
v = v << 8 | (long)b[i] & 0xff;
}
return v;
}