Java FileWriter Write saveFile(String[] lines, String savedName, String extension)

Here you can find the source of saveFile(String[] lines, String savedName, String extension)

Description

save File

License

Open Source License

Declaration

public static void saveFile(String[] lines, String savedName,
        String extension) throws Exception 

Method Source Code

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

import java.io.FileWriter;

public class Main {

    public static void saveFile(String[] lines, String savedName)
            throws Exception {
        FileWriter fw = new FileWriter("src/main/java/es/uniovi/asw/data/"
                + savedName + ".JSON");

        for (int i = 0; i < lines.length; i++) {
            fw.write(lines[i] + "\n");
        }// ww w  .  java2  s  . c  o m
        fw.close();
    }

    public static void saveFile(String[] lines, String savedName,
            String extension) throws Exception {
        FileWriter fw = new FileWriter("src/main/java/es/uniovi/asw/data/"
                + savedName + "." + extension);

        for (int i = 0; i < lines.length; i++) {
            fw.write(lines[i] + "\n");
        }
        fw.close();
    }
}

Related

  1. saveFile(String filePath, String data)
  2. saveFile(String path, Map> setup)
  3. saveFile(String path, String content)
  4. SaveFile(String path, String data, boolean deleteOnExit)
  5. saveFile(String path, String sb)
  6. saveFileContents(File file, String contents)
  7. saveFileFromString(File file, String encoding, String content)
  8. saveFiles(final List contents, final File outputDirectory, final String outputName, final String fileExtension)
  9. saveFlows(Map differences, String file)