code: public void writeBit (final int aBit) throws IOException
    {
      if (m_aOS == null)
        throw new IllegalStateException ("BitOutputStream is already closed");
      if (aBit != CGlobal.BIT_NOT_SET && aBit != CGlobal.BIT_SET)
        throw new IllegalArgumentException (aBit + " is not a bit");
  
      if (aBit == CGlobal.BIT_SET)
        if (m_bHighOrderBitFirst)
          m_nBuffer |= (aBit << (7 - m_nBufferedBitCount));
        else
          m_nBuffer |= (aBit << m_nBufferedBitCount);
  
      ++m_nBufferedBitCount;
      if (m_nBufferedBitCount == CGlobal.BITS_PER_BYTE)
        flush ();
    }
docs: Write a single bit to the stream. It will only be flushed to the underlying
  OutputStream when a byte has been completed or when flush() manually.
  
  @param aBit
  1 if the bit should be set, 0 if not
  @throws IOException
  In case writing to the output stream failed