private ulong DecodeInteger()
{
// by Pedro Martins
ulong value = (ulong)_stream.ReadByte();
if (value >= 0x80)
{
value &= 0x3F;
for (int i = 1; i < 8; i++)
{
int b = _stream.ReadByte();
value |= (ulong)(b & 0x7F) << ((i * 7) - 1);
if (b < 0x80)
{
break;
}
}
}
return value;
}