/**
   * Indicates that rejected entries should be written to the provided output stream. Note that this
   * applies only to entries that are rejected because they are invalid (e.g., are malformed or
   * don't conform to schema requirements), and not to entries that are rejected because they
   * matched exclude criteria.
   *
   * @param outputStream The output stream to which rejected entries should be written.
   */
  public void writeRejectedEntries(OutputStream outputStream) {
    if (outputStream == null) {
      closeRejectWriter();
      return;
    }

    rejectWriter = new BufferedWriter(new OutputStreamWriter(outputStream));
  }
  /**
   * Indicates that rejected entries should be written to the specified file. Note that this applies
   * only to entries that are rejected because they are invalid (e.g., are malformed or don't
   * conform to schema requirements), and not to entries that are rejected because they matched
   * exclude criteria.
   *
   * @param rejectFile The path to the file to which reject information should be written.
   * @param existingFileBehavior Indicates how to treat an existing file.
   * @throws IOException If a problem occurs while opening the reject file for writing.
   */
  public void writeRejectedEntries(String rejectFile, ExistingFileBehavior existingFileBehavior)
      throws IOException {
    if (rejectFile == null) {
      closeRejectWriter();
      return;
    }

    final BufferedWriter writer =
        newBufferedWriter(rejectFile, existingFileBehavior, ERR_REJECT_FILE_EXISTS);
    if (writer != null) {
      rejectWriter = writer;
    }
  }