/// <summary> /// Writes 1 to 8 bits of a byte /// </summary> public void Write(byte source, int numberOfBits) { EnsureBufferSize(m_bitLength + numberOfBits); NetBitWriter.WriteByte(source, numberOfBits, m_data, m_bitLength); m_bitLength += numberOfBits; }
/// <summary> /// Writes a boolean value using 1 bit /// </summary> public void Write(bool value) { EnsureBufferSize(m_bitLength + 1); NetBitWriter.WriteByte((value ? (byte)1 : (byte)0), 1, m_data, m_bitLength); m_bitLength += 1; }
public void Write(sbyte source) { EnsureBufferSize(m_bitLength + 8); NetBitWriter.WriteByte((byte)source, 8, m_data, m_bitLength); m_bitLength += 8; }