Java Text File Save writeFile(String path, Vector contents)

Here you can find the source of writeFile(String path, Vector contents)

Description

Write a Vector of lines to a file.

License

Open Source License

Declaration

public static void writeFile(String path, Vector<String> contents) 

Method Source Code

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

import java.io.BufferedWriter;

import java.io.FileWriter;
import java.io.IOException;
import java.util.Vector;

public class Main {
    /**//from   w w w.  j a  v  a2  s .co  m
     * Write a Vector of lines to a file.
     */
    public static void writeFile(String path, Vector<String> contents) {
        BufferedWriter writer = null;
        try {
            writer = new BufferedWriter(new FileWriter(path));
            for (String line : contents)
                writer.write(line + '\n');
        } catch (Exception ex) {
            System.err.println(ex);
        } finally {
            try {
                if (writer != null)
                    writer.close();
            } catch (IOException ex) {
            }
        }
    }
}

Related

  1. writeFile(String path, String fileName, String content, String charset)
  2. writeFile(String path, String fileName, String data)
  3. writeFile(String path, String text)
  4. writeFile(String path, String text)
  5. writeFile(String path, String text, boolean orverWite)
  6. writeFile(String pContent, String pPath)
  7. writeFile(String ruta, String nombre, byte[] archivo)
  8. WriteFile(String sFileName, String content)
  9. writeFile(String sFileName, String sContent)