/**
   * Sets the dictionary which should be used in the deflate process. The dictionary should be a
   * byte array containing strings that are likely to occur in the data which should be compressed.
   * The dictionary is not stored in the compressed output, only a checksum. To decompress the
   * output you need to supply the same dictionary again.
   *
   * @param dict the dictionary.
   * @param offset an offset into the dictionary.
   * @param length the length of the dictionary.
   * @exception IllegalStateException if setInput () or deflate () were already called or another
   *     dictionary was already set.
   */
  public void setDictionary(byte[] dict, int offset, int length) {
    if (state != INIT_STATE) throw new IllegalStateException();

    state = SETDICT_STATE;
    engine.setDictionary(dict, offset, length);
  }