code: public void toFile(File file, Engine engine, Reader reader) throws IOException {
          if (!file.createNewFile()) {
              FuzzyLite.logger().log(Level.FINE, "Replacing file {0}", file.getAbsolutePath());
          }
          BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
                  new FileOutputStream(file), FuzzyLite.UTF_8));
          if (exportHeaders) {
              writer.append(header(engine)).append("\n");
          }
          BufferedReader bufferedReader = new BufferedReader(reader);
          try {
              String line;
              int lineNumber = 0;
              while ((line = bufferedReader.readLine()) != null) {
                  ++lineNumber;
                  line = line.trim();
                  if (!line.isEmpty() && line.charAt(0) == '#') {
                      continue; //comments are ignored, blank lines are retained
                  }
                  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();
              writer.close();
          }
      }
docs: Saves the engine as a FuzzyLite Dataset into the specified file
  
  @param file is the file to save the dataset into
  @param engine is the engine to export
  @param reader is the reader of a set of lines containing space-separated
  input values
  @throws IOException if any error occurs upon reading or writing the file