void output( int code, OutputStream outs ) throws IOException
      {
      cur_accum &= masks[cur_bits];

      if ( cur_bits > 0 )
          cur_accum |= ( code << cur_bits );
      else
          cur_accum = code;

      cur_bits += n_bits;

      while ( cur_bits >= 8 )
          {
          char_out( (byte) ( cur_accum & 0xff ), outs );
          cur_accum >>= 8;
          cur_bits -= 8;
          }

      // If the next entry is going to be too big for the code size,
      // then increase it, if possible.
     if ( free_ent > maxcode || clear_flg )
          {
          if ( clear_flg )
              {
              maxcode = MAXCODE(n_bits = g_init_bits);
              clear_flg = false;
              }
          else
              {
              ++n_bits;
              if ( n_bits == maxbits )
                  maxcode = maxmaxcode;
              else
                  maxcode = MAXCODE(n_bits);
              }
          }

      if ( code == EOFCode )
          {
          // At EOF, write the rest of the buffer.
          while ( cur_bits > 0 )
              {
              char_out( (byte) ( cur_accum & 0xff ), outs );
              cur_accum >>= 8;
              cur_bits -= 8;
              }

          flush_char( outs );
          }
      }