Java Text File Save writeFile(Collection emailTree, String destFile)

Here you can find the source of writeFile(Collection emailTree, String destFile)

Description

write File

License

Open Source License

Declaration

public static void writeFile(Collection<String> emailTree, String destFile) 

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.Collection;

public class Main {
    public static void writeFile(Collection<String> emailTree, String destFile) {
        try {//from   ww w  . j a  v  a 2  s  . c om
            FileWriter fw = new FileWriter(new File(destFile));
            BufferedWriter bw = new BufferedWriter(fw);
            for (String email : emailTree) {
                bw.write(email + "\n");
            }
            bw.flush();
            bw.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Related

  1. serialize(final File folder, final String content, final String fileName)
  2. setText(File file, String text)
  3. writeFile(ArrayList lines, String dest_path)
  4. writeFile(File destinationFile, String contents, String encoding)
  5. writeFile(File outputDirectory, String fileName, String source)
  6. writeFile(File outputFile, ArrayList sortedLines, String lineSeparator)
  7. writeFile(File outputFile, String text)