/// <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); }
public sbyte ReadSByte() { byte retval = NetBitWriter.ReadByte(m_data, 8, m_readPosition); m_readPosition += 8; return((sbyte)retval); }
/// <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); }
/// <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); }
// // 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); }