code: private DataFileWriter<GenericRecord> createDataFileWriter(CodecFactory codecFactory) throws IOException {
      @SuppressWarnings("resource")
      DataFileWriter<GenericRecord> writer = new DataFileWriter<>(this.datumWriter);
      writer.setCodec(codecFactory);
  
      // Open the file and return the DataFileWriter
      return writer.create(this.schema, this.stagingFileOutputStream);
    }
docs: Create a new {@link DataFileWriter} for writing Avro records.
  
  @param codecFactory a {@link CodecFactory} object for building the compression codec
  @throws IOException if there is something wrong creating a new {@link DataFileWriter}