예제 #1
0
        /// <summary>
        /// Reads an SByte without advancing the read pointer
        /// </summary>
        public sbyte PeekSByte()
        {
            ReadOverflowException.Assert(_lengthBits - _readPosition >= 8);
            byte retval = BitReaderWriter.ReadByte(_data, 8, _readPosition);

            return((sbyte)retval);
        }
예제 #2
0
        //
        // 1 bit
        //
        /// <summary>
        /// Reads a 1-bit Boolean without advancing the read pointer
        /// </summary>
        public bool PeekBoolean()
        {
            ReadOverflowException.Assert(_lengthBits - _readPosition >= 1);
            byte retval = BitReaderWriter.ReadByte(_data, 1, _readPosition);

            return(retval > 0 ? true : false);
        }
예제 #3
0
        /// <summary>
        /// Reads 1 to 8 bits into a byte
        /// </summary>
        public byte ReadByte(int numberOfBits)
        {
            BitBufferException.Assert(numberOfBits > 0 && numberOfBits <= 8, "ReadByte(bits) can only read between 1 and 8 bits");
            byte retval = BitReaderWriter.ReadByte(_data, numberOfBits, _readPosition);

            _readPosition += numberOfBits;
            return(retval);
        }
예제 #4
0
        /// <summary>
        /// Reads a byte
        /// </summary>
        public byte ReadByte()
        {
            ReadOverflowException.Assert(_lengthBits - _readPosition >= 8);
            byte retval = BitReaderWriter.ReadByte(_data, 8, _readPosition);

            _readPosition += 8;
            return(retval);
        }
예제 #5
0
        /// <summary>
        /// Reads the specified number of bits into a Byte without advancing the read pointer
        /// </summary>
        public byte PeekByte(int numberOfBits)
        {
            byte retval = BitReaderWriter.ReadByte(_data, numberOfBits, _readPosition);

            return(retval);
        }