@Override
  public void configure(Configuration parameters) {
    super.configure(parameters);

    // read own parameters
    this.blockSize = parameters.getLong(BLOCK_SIZE_PARAMETER_KEY, NATIVE_BLOCK_SIZE);
    if (this.blockSize < 1 && this.blockSize != NATIVE_BLOCK_SIZE)
      throw new IllegalArgumentException("The block size parameter must be set and larger than 0.");
    if (this.blockSize > Integer.MAX_VALUE)
      throw new UnsupportedOperationException(
          "Currently only block size up to Integer.MAX_VALUE are supported");
  }
  /** {@inheritDoc} */
  @Override
  public void configure(Configuration parameters) {
    super.configure(parameters);

    this.numFields = parameters.getInteger(NUM_FIELDS_PARAMETER, -1);
    if (this.numFields < 1) {
      throw new IllegalArgumentException(
          "Invalid configuration for RecordOutputFormat: "
              + "Need to specify number of fields > 0.");
    }

    @SuppressWarnings("unchecked")
    Class<Value>[] arr = new Class[this.numFields];
    this.classes = arr;

    for (int i = 0; i < this.numFields; i++) {
      @SuppressWarnings("unchecked")
      Class<? extends Value> clazz =
          (Class<? extends Value>) parameters.getClass(FIELD_TYPE_PARAMETER_PREFIX + i, null);
      if (clazz == null) {
        throw new IllegalArgumentException(
            "Invalid configuration for RecordOutputFormat: " + "No type class for parameter " + i);
      }

      this.classes[i] = clazz;
    }

    this.recordPositions = new int[this.numFields];
    boolean anyRecordPosDefined = false;
    boolean allRecordPosDefined = true;

    for (int i = 0; i < this.numFields; i++) {

      int pos = parameters.getInteger(RECORD_POSITION_PARAMETER_PREFIX + i, Integer.MIN_VALUE);

      if (pos != Integer.MIN_VALUE) {
        anyRecordPosDefined = true;

        if (pos < 0) {
          throw new IllegalArgumentException(
              "Invalid configuration for RecordOutputFormat: "
                  + "Invalid record position for parameter "
                  + i);
        }

        this.recordPositions[i] = pos;

      } else {
        allRecordPosDefined = false;

        this.recordPositions[i] = i;
      }
    }

    if (anyRecordPosDefined && !allRecordPosDefined) {
      throw new IllegalArgumentException(
          "Invalid configuration for RecordOutputFormat: "
              + "Either none or all record positions must be defined.");
    }

    this.recordDelimiter =
        parameters.getString(RECORD_DELIMITER_PARAMETER, AbstractConfigBuilder.NEWLINE_DELIMITER);
    if (this.recordDelimiter == null) {
      throw new IllegalArgumentException(
          "The delimiter in the DelimitedOutputFormat must not be null.");
    }
    this.charsetName = parameters.getString(RECORD_DELIMITER_ENCODING, null);
    this.fieldDelimiter = parameters.getString(FIELD_DELIMITER_PARAMETER, "|");
    this.lenient = parameters.getBoolean(LENIENT_PARSING, false);
  }