internal static int ReadItemTypeAndLength(BinaryReader aReader, out long aLength)
{
byte b = aReader.ReadByte();
int type = b >> 4 & 0x07;
aLength = b & 0x0f;
int shift = 4;
while ((b & 0x80) > 0)
{
b = aReader.ReadByte();
aLength += (b & 0x7f) << shift;
shift += 7;
}
return (type);
}