Java FileWriter Write saveFlows(Map differences, String file)

Here you can find the source of saveFlows(Map differences, String file)

Description

save Flows

License

Open Source License

Declaration

public static void saveFlows(Map<String, Double> differences, String file) throws IOException 

Method Source Code

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

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

import java.io.FileWriter;
import java.io.IOException;

import java.util.Map;

public class Main {
    public static void saveFlows(Map<String, Double> differences, String file) throws IOException {

        try {/*from  w w w . ja  v  a  2 s .  c  o m*/
            File f = new File(file);
            if (!f.exists()) {
                f.createNewFile();
            }
            FileWriter fw = new FileWriter(f.getAbsoluteFile());
            BufferedWriter bw = new BufferedWriter(fw);
            bw.write("gene\tflows");
            bw.newLine();
            for (String gene : differences.keySet()) {
                bw.write(gene + "\t" + differences.get(gene));
                bw.newLine();
            }
            bw.close();
        } catch (IOException e) {
            throw new IOException("Error creating or writing " + file, e);
        }
    }
}

Related

  1. saveFile(String path, String sb)
  2. saveFile(String[] lines, String savedName, String extension)
  3. saveFileContents(File file, String contents)
  4. saveFileFromString(File file, String encoding, String content)
  5. saveFiles(final List contents, final File outputDirectory, final String outputName, final String fileExtension)
  6. saveFormedClustersToFile(Vector names, Collection> clusters, String filename)
  7. saveGraph(List> graph, String sFileName)
  8. saveIndex(File root_, Hashtable index)
  9. saveInputStreamInFile(InputStream stream, FileWriter f)