public int ReadBigEndian7BitEncodedInt()
{
CheckDisposed();
int ret=0;
for (int i=0; i < 5; i++)
{
int b = stream.ReadByte();
if (b==-1)
{
throw new EndOfStreamException();
}
ret = (ret << 7) | (b&0x7f);
if ((b & 0x80) == 0)
{
return ret;
}
}
// Still haven't seen a byte with the high bit unset? Dodgy data.
throw new IOException("Invalid 7-bit encoded integer in stream.");
}