PeerCastStation.MKV.VInt.ReadUInt C# (CSharp) Méthode

ReadUInt() public static méthode

public static ReadUInt ( Stream s ) : VInt
s Stream
Résultat VInt
    public static VInt ReadUInt(Stream s)
    {
      int b = s.ReadByte();
      if (b<0) throw new EndOfStreamException();
      int len = CheckLength(b);
      var bin = new byte[len];
      bin[0] = (byte)b;
      long res = b;
      for (var i=1; i<len; i++) {
        b = s.ReadByte();
        if (b<0) throw new EndOfStreamException();
        bin[i] = (byte)b;
        res = (res<<8) | (byte)b;
      }
      res &= (1<<(7*len))-1;
      return new VInt(res, bin);
    }

Usage Example

        public static Element ReadHeader(Stream s)
        {
            var id = VInt.ReadUInt(s);
            var sz = VInt.ReadUInt(s);

            return(new Element(id, sz));
        }
All Usage Examples Of PeerCastStation.MKV.VInt::ReadUInt