예제 #1
0
        /// <summary>
        /// Reads 1 to 8 bits into a byte
        /// </summary>
        public byte ReadByte(int numberOfBits)
        {
            byte retval = NetBitWriter.ReadByte(m_data, numberOfBits, m_readPosition);

            m_readPosition += numberOfBits;
            return(retval);
        }
예제 #2
0
        public sbyte ReadSByte()
        {
            byte retval = NetBitWriter.ReadByte(m_data, 8, m_readPosition);

            m_readPosition += 8;
            return((sbyte)retval);
        }
예제 #3
0
        /// <summary>
        /// Reads a boolean value (stored as a single bit) written using Write(bool)
        /// </summary>
        public bool ReadBoolean()
        {
            byte retval = NetBitWriter.ReadByte(m_data, 1, m_readPosition);

            m_readPosition += 1;
            return(retval > 0);
        }
예제 #4
0
 /// <summary>
 /// Reads a byte and returns true or false for success
 /// </summary>
 public bool ReadByte(out byte result)
 {
     if (m_bitLength - m_readPosition < 8)
     {
         result = 0;
         return(false);
     }
     result          = NetBitWriter.ReadByte(m_data, 8, m_readPosition);
     m_readPosition += 8;
     return(true);
 }
예제 #5
0
        //
        // 8 bit
        //
        /// <summary>
        /// Reads a Byte without advancing the read pointer
        /// </summary>
        public byte PeekByte()
        {
            byte retval = NetBitWriter.ReadByte(m_data, 8, m_readPosition);

            return(retval);
        }