int inflateSetDictionary(byte[] dictionary, int dictLength){
    if(z==null || (this.mode != DICT0 && this.wrap != 0)){
      return Z_STREAM_ERROR;
    }

    int index=0;
    int length = dictLength;

    if(this.mode==DICT0){
      long adler_need=z.adler.getValue();
      z.adler.reset();
      z.adler.update(dictionary, 0, dictLength);
      if(z.adler.getValue()!=adler_need){
        return Z_DATA_ERROR;
      }
    }

    z.adler.reset();

    if(length >= (1<<this.wbits)){
      length = (1<<this.wbits)-1;
      index=dictLength - length;
    }
    this.blocks.set_dictionary(dictionary, index, length);
    this.mode = BLOCKS;
    return Z_OK;
  }