/// <summary>
        /// Reads a UInt32 without advancing the read pointer
        /// </summary>
        public UInt32 PeekUInt32()
        {
            ReadOverflowException.Assert(_lengthBits - _readPosition >= 32);
            uint retval = BitReaderWriter.ReadUInt32(_data, 32, _readPosition);

            return(retval);
        }
        /// <summary>
        /// Reads the specified number of bits into an Int32 without advancing the read pointer
        /// </summary>
        public Int32 PeekInt32(int numberOfBits)
        {
            BitBufferException.Assert((numberOfBits > 0 && numberOfBits <= 32), "ReadInt() can only read between 1 and 32 bits");
            ReadOverflowException.Assert(_lengthBits - _readPosition >= numberOfBits);

            uint retval = BitReaderWriter.ReadUInt32(_data, numberOfBits, _readPosition);

            if (numberOfBits == 32)
            {
                return((int)retval);
            }

            int signBit = 1 << (numberOfBits - 1);

            if ((retval & signBit) == 0)
            {
                return((int)retval);                // positive
            }
            // negative
            unchecked
            {
                uint mask = ((uint)-1) >> (33 - numberOfBits);
                uint tmp  = (retval & mask) + 1;
                return(-((int)tmp));
            }
        }
        /// <summary>
        /// Reads the specified number of bits into a UInt32 without advancing the read pointer
        /// </summary>
        public UInt32 PeekUInt32(int numberOfBits)
        {
            BitBufferException.Assert((numberOfBits > 0 && numberOfBits <= 32), "ReadUInt() can only read between 1 and 32 bits");
            //NetException.Assert(m_bitLength - m_readBitPtr >= numberOfBits, "tried to read past buffer size");

            UInt32 retval = BitReaderWriter.ReadUInt32(_data, numberOfBits, _readPosition);

            return(retval);
        }
        //
        // 64 bit
        //
        /// <summary>
        /// Reads a UInt64 without advancing the read pointer
        /// </summary>
        public UInt64 PeekUInt64()
        {
            ReadOverflowException.Assert(_lengthBits - _readPosition >= 64);

            ulong low  = BitReaderWriter.ReadUInt32(_data, 32, _readPosition);
            ulong high = BitReaderWriter.ReadUInt32(_data, 32, _readPosition + 32);

            ulong retval = low + (high << 32);

            return(retval);
        }
        /// <summary>
        /// Reads the specified number of bits into an UInt64 without advancing the read pointer
        /// </summary>
        public UInt64 PeekUInt64(int numberOfBits)
        {
            BitBufferException.Assert((numberOfBits > 0 && numberOfBits <= 64), "ReadUInt() can only read between 1 and 64 bits");
            ReadOverflowException.Assert(_lengthBits - _readPosition >= numberOfBits);

            ulong retval;

            if (numberOfBits <= 32)
            {
                retval = (ulong)BitReaderWriter.ReadUInt32(_data, numberOfBits, _readPosition);
            }
            else
            {
                retval  = BitReaderWriter.ReadUInt32(_data, 32, _readPosition);
                retval |= (UInt64)BitReaderWriter.ReadUInt32(_data, numberOfBits - 32, _readPosition + 32) << 32;
            }
            return(retval);
        }