code: public void setKey(int index, byte[] key) throws IOException {
          if (index >= structure.keySizes.size()) {
              throw new IOException("Index " + index + " is out of range.");
          }
          int length = structure.keySizes.get(index);
          if (key.length != length) {
              throw new IOException("The length of the given key is not equal to the expected one. (" + key.length
                      + "!=" + length + ")");
          }
          Bytes.putBytes(this.key, structure.keyByteOffsets.get(index), key, 0, key.length);
      }
docs: Sets the key belonging to the given field.
  
  @param index
  the index of the requested field
  @param key
  the key to set
  @throws IOException