code: public void toFile(File file, Engine engine, int values, ScopeOfValues scope,
              List<InputVariable> activeVariables) 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));
          try {
              write(engine, writer, values, scope, activeVariables);
          } catch (RuntimeException ex) {
              throw ex;
          } catch (IOException ex) {
              throw ex;
          } finally {
              writer.close();
          }
      }
docs: Saves the engine as a FuzzyLite Dataset into the specified file
  
  @param file is file to save the dataset into
  @param engine is the engine to export
  @param values is the number of values to export
  @param scope indicates the scope of the values
  @param activeVariables contains the input variables to generate values for.
  The input variables must be in the same order as in the engine. A value of
  fl::null indicates the variable is not active.
  @throws IOException if any error occurs upon writing to the file