System.IO.BitSplitter.GetFlag C# (CSharp) Méthode

GetFlag() public méthode

Read a single bit, and return true if set to '1'. Advances position by 1 bit
public GetFlag ( ) : bool
Résultat bool
        public bool GetFlag()
        {
            byte[] v = GetNext(1);
            if (v.Length != 1) throw new Exception("Unexpected bytes!");
            return v[0] != 0;
        }

Usage Example

            private void ValidateTable(BitSplitter bs)
            {
                int pointer = (int)bs.GetInteger(8);
                if (pointer != 0) throw new DemuxException("Non-zero pointers are not currently supported");

                int table_id = (int)bs.GetInteger(8);
                if (table_id != 0x02) throw new DemuxException("Wrong table ID for PMT");

                SectionSyntax = bs.GetFlag();
                if (!SectionSyntax) throw new DemuxException("Invalid PMT: incorrect section syntax");
                bool zero = bs.GetFlag();
                if (zero) throw new DemuxException("Invalid PMT: zero bit wasn't zero");
            }
All Usage Examples Of System.IO.BitSplitter::GetFlag