Java FileWriter Write saveModelInFile(final String model, final String filename)

Here you can find the source of saveModelInFile(final String model, final String filename)

Description

Creates and returns a file that contains the argument model as content.

License

Open Source License

Parameter

Parameter Description
model a parameter

Exception

Parameter Description
Exception an exception

Declaration

static public File saveModelInFile(final String model,
        final String filename) throws Exception 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedWriter;
import java.io.File;

import java.io.FileWriter;

public class Main {
    /**/*from   w  w w .j a  va 2  s . c om*/
     * Creates and returns a file that contains the argument model as content.
     *
     * @param model
     * @return
     * @throws Exception
     */
    static public File saveModelInFile(final String model,
            final String filename) throws Exception {

        final File f = new File(filename);
        final BufferedWriter bw = new BufferedWriter(new FileWriter(f));
        bw.write(model);
        bw.close();
        return f;
    }
}

Related

  1. saveMap(String filename, Map map)
  2. saveMappingFile(File mappingFile, Map messageMap)
  3. saveMeasures(String appDirPath, String fileName, double[] measures)
  4. saveMetaClassToFile(File baseDir, String clazzDef, String metaPackageName, Class fromClazz)
  5. saveMetadata(Map metadata, File file)
  6. savePValue2File(double[] pValue, String fileName)
  7. saveSeqAln(String[] alnSequences, String filePath)
  8. saveSimpleTextFile(String data, String path, String filename)
  9. saveStats(String filename, String log)