code: public void write(Engine engine, Writer writer, Reader reader) throws IOException {
          if (exportHeaders) {
              writer.append(header(engine)).append("\n");
          }
  
          String line;
          int lineNumber = 0;
          BufferedReader bufferedReader = new BufferedReader(reader);
          try {
              while ((line = bufferedReader.readLine()) != null) {
                  ++lineNumber;
                  List<Double> inputValues;
                  if (lineNumber == 1) { //automatic detection of header.
                      try {
                          inputValues = parse(line);
                      } catch (Exception ex) {
                          continue;
                      }
                  } else {
                      inputValues = parse(line);
                  }
                  write(engine, writer, inputValues, engine.getInputVariables());
              }
          } catch (RuntimeException ex) {
              throw ex;
          } catch (IOException ex) {
              throw ex;
          } finally {
              bufferedReader.close();
          }
      }
docs: Writes the engine into the given writer
  
  @param engine is the engine to export
  @param writer is the output where the engine will be written to
  @param reader is the reader of a set of lines containing space-separated
  input values
  @throws IOException if any error occurs upon writing to the writer