public void flushBits() throws IOException {
  if (bitPos == 0) {
    return;
  }
  out.write(bitBuf);
  bitBuf=0;
  bitPos=0;
  bytesWritten++;
}

public void flushBits ( ) throws IOException { if ( bitPos == 0 ) { return ; } out . write ( bitBuf ) ; bitBuf = 0 ; bitPos = 0 ; bytesWritten ++ ; }
flush the bit buffer to the output stream and reset values
