System.StreamExtensions.Read7BitEncodedInt C# (CSharp) Méthode

Read7BitEncodedInt() public static méthode

public static Read7BitEncodedInt ( this stream ) : int
stream this
Résultat int
        public static int Read7BitEncodedInt(this Stream stream)
        {
            var buffer = Buffer;
            int num1 = 0;
            int num2 = 0;
            while (num2 != 35)
            {
                if (stream.Read(buffer, 0, 1) == 0)
                    throw new EndOfStreamException();
                byte num3 = buffer[0];
                num1 |= ((int)num3 & (int)sbyte.MaxValue) << num2;
                num2 += 7;
                if (((int)num3 & 128) == 0)
                    return num1;
            }
            throw new FormatException("Bad string length. 7bit Int32 format");
        }